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
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):
- create partition for
/home
- create file system (e.g. ext4) =>
mkfs.ext4 /dev/sdb2
- mount it as
/home
=> for example =>mount -t ext4 /dev/sdb2 /home
- 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 - Use rsync to copy data, e.g. from a backup mounted as /backup/home
rsync -axHAX --progress --verbose /backup/home/ /home
- Remember to edit your
/etc/fstab
and update the block device/FS for new/home
Reboot and you should be good to go;-)
-
2You might want to run the
rsync
command withsudo
to preserve ownership information too. Nov 15, 2012 at 3:06