Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed Ubuntu on my netbook quite some time ago, and I don't remember what did I do - but I'd expect I went with more or less default settings. Now I have two partitions (one ext3 and one ext4, the first one being bigger and practically unused, apart from an empty lost+found directory). What (apart from my stupidity, which might be the cause - e.g., it's not impossible that I wanted it to be my /home and somehow forgot to actually tell the installer to do so) might be the cause of such a strange situation? If this partition is not really necessary (which is probably the case - it is not being mounted by default anyway), what is the best way to move my /home there? I imagine that this should suffice:

  1. I mount that partition under /mnt or anywhere and cp -rp /home/* there.
  2. I use gparted to make it my new /home.
  3. I boot to check whether everything works.
  4. I manually unmount it to manually clean the old /home.

Did I miss something?

Edit: as Eric Carvalho asked, here's my output of fdisk -l:

$ LANGUAGE=C sudo fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x05c9ff3a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      409599      203776    7  HPFS/NTFS/exFAT
/dev/sda2          417690   285075455   142328883    7  HPFS/NTFS/exFAT
/dev/sda3       285075456   323862527    19393536    7  HPFS/NTFS/exFAT
/dev/sda4       323864574   488396799    82266113    5  Extended
/dev/sda5       323864576   328058879     2097152   82  Linux swap / Solaris
/dev/sda6       328060928   449107698    60523385+  83  Linux
/dev/sda7       449107968   486324223    18608128   83  Linux
/dev/sda8       486326272   488396799     1035264   82  Linux swap / Solaris

and df -h (which I guess is more or less irrelevant, since the partition is unmounted by default):

$ LANGUAGE=C df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda7        18G   16G  1,1G  94% /
udev            488M   12K  488M   1% /dev
tmpfs           198M  876K  198M   1% /run
none            5,0M     0  5,0M   0% /run/lock
none            495M  224K  495M   1% /run/shm
share|improve this question
Please post the output of sudo fdisk -l and df -h. – Eric Carvalho Dec 22 '12 at 0:24
@EricCarvalho: thanks for the interest in my question, I included the output of these commands. – mbork Dec 22 '12 at 0:34

/dev/sda7 is your 18GB / partition and /dev/sda6 is a 58GB partition you said is empty.

  1. Set a password for "root" account: open a terminal (Ctrl+Alt+T) an run sudo passwd root, then type a password for "root".

  2. Reboot the computer. At the login screen hit Ctrl+Alt+F1 to open the text console and login as root (username: root, password: "the one you typed in step 1").

  3. Create a temporary directory (mkdir /tmp/home) and mount the new home partition (mount /dev/sda7 /tmp/home).

  4. Move the home directories to the new location: mv /home/* /tmp/home/.

  5. Get the UUID of new home: blkid /dev/sda6.

  6. Update fstab: nano /etc/fstab. Add the following to the end: UUID=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee /home ext4 defaults 0 2. Replace the UUID with the one you got in step 5.

  7. Unmount the new home: umount /tmp/home.

  8. Mount the new home in the correct location: mount /home.

  9. Logout from text console (exit), return to graphics console (Ctrl+Alt+F7 or F8) and login with your account.

  10. Lock the root account: open a terminal and run sudo passwd -l root.


share|improve this answer
This method is quicker than using a live CD but it has the disadvantage to let you with a password for root set (defeating partly the purpose of sudo). A few small corrections have to be made: step 3: it's '/dev/sda6. Step 5: use blkid /dev/sda6` instead of 7 (new home is sda6). Step 6: in fstab, it is ext3 and not ext4 – laurent Dec 22 '12 at 4:06
@laurent Thanks. Answer updated. Added instructions to lock root account. Ext3 filesystems can be mounted as ext4, there's no problem. – Eric Carvalho Dec 22 '12 at 4:24

As you can't unmount your home while logged in, the easiest option in my opinion is to boot from a live CD and do something similar to the following:

Mount the new home partition (I will assume in /mnt/new for the rest of the answer) and the root partition (where is the old home) (in /mnt/old).

sudo mkdir /mnt/new
sudo mkdir /mnt/old
sudo mount -t ext4 /dev/sda7 /mnt/old
sudo mount -t ext3 /dev/sda6 /mnt/new

With both mounted, you can move from old to new:

sudo mv /mnt/old/home /mnt/new

Create an empty home (mount point) on root disk:

sudo mkdir /mnt/old/home

Edit /etc/fstab on our root partition to include the new home partition:

sudo nano /mnt/old/etc/fstab

/dev/sda6 /home ext3 defaults 0 2

Obs: check if your sda6 partition is ext3 if you are not sure (I used ext3 based on the text in your question).

Remove the CD and reboot. It should work!

A few improvements I suggest:

While you are at it, you have 2 swap partitions and I don't think this is very usefull so you could remove one... (gparted can do that - you have to disable swap and remove the partition and enable swap again - check after in fstab if it is correct).

If you have a chance to include new disks in the future (I always consider there is a chance), I think it would be safer to use UUID=uuid_of_the_partition instead of /dev/sda6 in fstab:

UUID=uuid-of-your-sda6 /home ext3 defaults 0 2

UUIDs don't change, even if the disk is moved to another port on the interface so you'll always mount the correct disk. Using /sda, if you include a disk and change the position of the actual disk in the interface, you have a fair chance to change its name to sdb for example and your home won't mount (very common when using USB external disks for example). To find the uuid of the partitions, while booted on your normal way (without live CD) you can issue ls -l /dev/disk/by-uuid and you'll see uuids as symlinks to the actual devices. Another way if you prefer is to use gparted and look at the info of the partition.

share|improve this answer
  1. Your copy command does not copy special files. cpio is a little better. I used that when i moved my home from one computer to the next. Some use rsync instead help.ubuntu.

    cd /home/
    find . -depth -print0 | cpio --null --sparse -pvd /mnt/
  2. You cannot unmount /home if you are logged in (your step 4). You must do it in recovery mode if you dont follow help ubuntu

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.