Thursday, May 17, 2012

Add new Harddrive to ubuntu

Situation: the old /home directory is too small.  I want to add a new hard drive and mount it as /home.

1. sudo fdisk -l to check whether ubuntu detects the new harddrive and identify the new harddrive identity (the one without mounting point, ex. sdb)

2. sudo fdisk /dev/sdb
     press 'n' to create new partition.
     press 'p' to add primary partition.
     press '1' to name partition number.
     enter the first and the last section
     press 'L' to list available file sysetem type
     choice '83' (linux)
     press 'w' to write to the table and exit

3. sudo partprobe /dev/sdb

4. sudo mkfs /dev/sdb1 -t ext4

5. sudo mkdir /mnt/sdb1

6. sudo chmod 777 /mnt/sdb1

7. sudo mount /dev/sdb1 /mnt/sdb1 -t ext4

8. sudo cp -R /home /mnt/sdb1

9. sudo vi /etc/fstab
    add "/dev/sdb1 /home ext4 defaults 0 0 to the file, save and quit

10. backup the home folder to other places, then delete all in /home

11.  sudo mount -a

12. reboot and done.

No comments:

Post a Comment