Twitter Updates

Friday 30 May 2008

Moving the /home dir

I am currently working on a low power mini-itx server. The operating system and boot partition is a 8GB flash drive, with a 1TB SATA drive for storage which can be powered down when not being used.

The OS is Ubuntu, running samba. I will be backing up my laptop to the server and so lots of data will be going into the homes directory. Therefore I need to move the /home/ directory to the 1TB Drive.

The partitioning/formatting/mounting steps taken for /dev/sda.

Partitioning http://tldp.org/HOWTO/Partition/fdisk_partitioning.html
$ sudo fdisk /dev/sda
option n to edit partition table.
option w to write the new partition.

Format ext3
$ sudo mke2fs -j /dev/sda1

Mounting, edit /etc/fstab
$ sudo mkdir -p /mnt/hostname/partitionname
$ sudo vim /etc/fstab

added this line
/dev/sda1 /mnt/hostname/partitionname ext3 rw,auto,async,errors=remount-ro 0 1

then
$ sudo mount -a

The new partition is now mounted.
Now move the homes directory
$ sudo cp -ax /home /mnt/hostname/partitionname/
$ sudo mv /home /home.old
$ sudo ln -s /mnt/hostname/partitionname/home /

No comments: