Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: HOWTO move /home to a new hard drive

  1. #1
    Join Date
    Aug 2006
    Location
    Canada
    Beans
    120
    Distro
    Ubuntu 6.10 Edgy

    HOWTO move /home to a new hard drive

    This HOWTO describes how to move your current /home partition to a new hard drive if you already have /home as its own partition.

    I will use my situation as an example but you should be able to adapt this HOWTO to your own situation.

    I had a 20GB hard drive with three partitions, /, SWAP and /home.

    I had a 150GB hard drive with one partition on it from another computer. I had two folders of data on this drive one called Music and another called Videos.

    I physically installed the drive and then restarted the computer.

    ************************************************** *************************
    You may have a new drive without any partitions or data on it. If this is the case then after you have physically installed the drive boot up using the Live CD and open a terminal. Use gparted to create a new partition on your new drive. You start gparted by typing this in a terminal sudo gparted

    You will have to select your new drive from the top right hand side of the screen. gparted is pretty straight forward. If you have any trouble with creating a partition in gparted I am sure a quick search of the internet will give you a wealth of information.
    ************************************************** *************************

    So continuing with this HOWTO I opened a terminal and created a mount point:

    Code:
    $sudo mkdir /media/newhome
    I then edited /etc/fstab to include the line:

    Code:
    /dev/hdb1 /media/newhome ext3 defaults 0 0
    You will need to replace hdb1 with whatever drive label and partition you have.

    Reboot and you should see newdrive on your desktop. Now is the most important step, we need to copy ALL of the contents of /home onto the new drive. Type this exactly:

    Code:
    $cd /home/
    $find . -depth -print0 | cpio --null --sparse -pvd /media/newhome/
    These commands are important to copy all of the hidden files, hard links and sym links. This command may take a while to run.

    We are almost there.

    Now edit /etc/fstab again, this time uncomment out your old /home by putting a # at the start of the line.

    Now edit the line for your new drive to mount it to /home, here is mine:

    Code:
    /dev/hdb1 /home ext3 defaults 0 2
    Save this and restart.

    Your /home is now on your new drive. I then moved my Music and Video folders into the /home/username folder.

    The last thing I did was to resize my / partition to use the rest of my 20GB drive. To do this I booted up using the Live CD and ran gparted again. I deleted the old /home partition and then moved my SWAP to one end of the drive. I then resized / to fill the rest of the 20GB.

    Thats it.

    I hope this HOWTO was useful. If you have any questions please ask and I will do my best to help.

  2. #2
    Join Date
    Apr 2006
    Beans
    10

    Re: HOWTO move /home to a new hard drive

    Wouldn't it be simpler to just use rsync. To get all hidden files and maintain permissions you could just use the command:

    rsync -avP /target_directory /destination_directory

  3. #3
    Join Date
    Aug 2006
    Location
    Canada
    Beans
    120
    Distro
    Ubuntu 6.10 Edgy

    Re: HOWTO move /home to a new hard drive

    Quote Originally Posted by andylawrence View Post
    Wouldn't it be simpler to just use rsync. To get all hidden files and maintain permissions you could just use the command:

    rsync -avP /target_directory /destination_directory
    That may be true, and may be easier. I am still relatively new to Linux and the method used in this HOWTO was just the info I found that allowed me to do this.

  4. #4
    Join Date
    Oct 2005
    Location
    Belgium
    Beans
    568
    Distro
    Hardy Heron (Ubuntu Development)

    Re: HOWTO move /home to a new hard drive

    I can confirm, I made it with rsync as you said and it worked well.

  5. #5
    Join Date
    Aug 2006
    Beans
    23
    Distro
    Kubuntu 6.06

    Re: HOWTO move /home to a new hard drive

    Quote Originally Posted by andylawrence View Post
    Wouldn't it be simpler to just use rsync. To get all hidden files and maintain permissions you could just use the command:

    rsync -avP /target_directory /destination_directory
    Hi, I have gone through this a couple of times, and i will say rsync just appears to be more stable and robust than the find -> cpio pipe method.

    I use some different option switches, though:
    Code:
    rsync -aS /target_directory /destination_directory
    I admit the verbose mode -v may be nice in case of something going wrong, but i haven't had then need for it yet.

    The -P option, what does it really improve? Are partially transferred files that important, wouldn't you just keep trying until all of it is transferred before you delete?

  6. #6
    Join Date
    Jan 2008
    Beans
    2
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Exclamation Re: HOWTO move /home to a new hard drive

    I tried this, and it worked fine - except it copied all files, even from mounted file systems. Would -x (one-file-system) work so it only copies from the actual disk and not from mounted file systems?

  7. #7
    Join Date
    Dec 2007
    Beans
    53

    Re: HOWTO move /home to a new hard drive

    The contents of my home folder are already on another disc. However I had to reinstall Ubuntu a few times, therefore the contents are isolated on my second hard drive. In that case, wouldn't I only have to edit fstab?

  8. #8
    Join Date
    Feb 2008
    Beans
    124
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOWTO move /home to a new hard drive

    Thanks a lot for this helpful guide.

    Ubuntu 12.04: E8200 // P35 // 4GB // HD4850
    OS X 10.7.x: iMac 12,2; MacBook 5,2

  9. #9
    Join Date
    Apr 2007
    Location
    Nigeria
    Beans
    172
    Distro
    Kubuntu 12.10 Quantal Quetzal

    Re: HOWTO move /home to a new hard drive

    This thread is old but, a question: I have a laptop with ubuntu all configured to my liking and running fine. I want to buy a new one. Is it in any way possible (ANY at all) to move this config i.e. my home folder, along with all my files straight to the new one, similar to the steps above?

  10. #10
    Join Date
    Nov 2006
    Location
    Toronto, Canada
    Beans
    144
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: HOWTO move /home to a new hard drive

    Interesting question. You could try using Unison: it can handle connections over SSH connections. I do that to keep my documents synced across my laptop and desktop.
    I must be updating Ubuntu. How else could I be expected to take seriously the phrase, "Unpacking replacement gnome"?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •