4

I have formatted my hard disks so that /home sits in one separate disk. Now that disk has become faulty. I am wondering whether it is possible to replace only that disk and make a new /home partion on a new disk, so that I can avoid a complete reinstall of the OS? (I know that almost all my user data will be lost)

1 Answer 1

7

Answer is yes, you don't need to re-install OS. You can create a new partition (block device like /dev/sdb2) and use it for /home. You can also copy the data in old /home over if you have a good backup or the old home is still readable.

In your case, it seems that the old /home (disk) became faulty. You want to use a new partition or new disk for /home. It is fine and you don't need to re-install the OS.

Steps in brief (recommend doing this using a LIVE CD, you don't HAVE TO though):

  1. create partition for /home
  2. create file system (e.g. ext4) => mkfs.ext4 /dev/sdb2
  3. mount it as /home => for example => mount -t ext4 /dev/sdb2 /home
  4. mount your old home if it is still mountable, e.g. mount -t fs_type /dev/sdaX /mnt/old_home otherwise you'll have to restore data from a good backup
  5. Use rsync to copy data, e.g. from a backup mounted as /backup/home rsync -axHAX --progress --verbose /backup/home/ /home
  6. Remember to edit your /etc/fstab and update the block device/FS for new /home

Reboot and you should be good to go;-)

1
  • 2
    You might want to run the rsync command with sudo to preserve ownership information too. Nov 15, 2012 at 3:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .