Category: Linux and Open Source

Sometimes the growth of a filesystem (particularly /home ) means that it is necessary to find it a new home; in other words, add another physical disk and relocate the filesystem to its new home where there is room to grow.

Here is the procedure for adding another drive, with a single partition which will become the new /home filesystem (I'm assuming fdisk has already been used to partition it):

As root:

# mkdir /mnt/newhome
# mkfs –t ext2 /dev/hdb1
# mount /dev/hdb1 /mnt/newhome
# (cd /home && tar cf - .) | (cd /mnt/newhome && tar xpf -)


# umount /home
# mv /home /home.old
# mkdir /home
# umount /mnt/newhome
# mount /dev/hdb1 /home

Once the new /home directory tree has been checked out, you can then safely

# rm –rf /home.old
# rmdir /mnt/newhome

to clean up. Don't forget to edit /etc/fstab to mount the new filesystem into /home!


It is also possible to move subdirectory trees between systems using a refinement of the above technique of piping between tars. For example:

(cd /home && tar cf .) | ssh backuphost (cd /var/backup && tar xpf -)

will back up the contents of the home directory from one system to another.