1.04.2015

Move home dir to another drive

Got it from here.
First install the drive, then follow these steps:
1. Find UUID of the partition
root@mango:~# blkid 
/dev/sdb1: UUID="8b1e1564-d7b6-4ef4-9ffd-d7d191251cc2" TYPE="ext4" PARTUUID="0835b8cd-01"

2. Modify fstab
root@mango:~# vim /etc/fstab
Add this line
UUID=8b1e1564-d7b6-4ef4-9ffd-d7d191251cc2 /media/home          ext4    defaults        0       2

3. Create temporary mount point
root@mango:~# mkdir /media/home

4. Reload fstab
root@mango:~# mount -a

5. Copy /home to new partition
root@mango:~# rsync -aXS --exclude='/*/.gvfs' /home/. /media/home/.

6. Prepare fstab for the switch
root@mango:/home/samdc# vim /etc/fstab
Modify this line to:
UUID=8b1e1564-d7b6-4ef4-9ffd-d7d191251cc2 /home          ext4    defaults        0       2

7. Do the switch
root@mango:~# cd / && sudo mv /home /old_home && sudo mkdir /home

8. Reload fstab
root@mango:/# mount -a

9. Delete old home
root@mango:/# rm -r /old_home

10. Reboot
==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case

No comments:

Post a Comment