free counters
Diberdayakan oleh Blogger.

Senin, 22 September 2014

How to properly moving home directory to new partition in linux Slackware

by Unknown  |  in Tutorial at  Senin, September 22, 2014

This tutorial has been tested with my Slackware64 14.1. This should be working with another linux distro with no or very small change.

To properly moving or migrating our home directory to a new dedicated partition, we can use these step below:

1. Create new partition.
2. Mount the new partition to a directory.
3. Copy all data from home partition to new partition (directory) with rsync command.
4. Move home partition to /oldhome.
5. Umount home and new partition directory then remount new partition directory.
6. Edit fstab by adding new entry pointing to the new partition.
7. Confirm that everything is okay, then delete /oldhome .


Let's explain the details.
1. Create new partition.
Provide a partition that will be our new home partition. For the rest of our tutorial, home partition will be /home. If your home partition differ than /home, change /home to your home partition. Our new home partition will be /dev/sda2. Change /dev/sda2 according to your new partition.

2. Mount the new partition to a directory.
Mount our new partition, /dev/sda2, to a directory. Here we use /homes as the directory. We use the following steps:
a. create /homes directory

 mkdir /homes  
b. mount /dev/sda2 to /homes
 mount /dev/sda2 /homes 
3. Copy all data from home partition to new partition (directory) with rsync command.
Copy all data from /home to /homes using rsync. W use rsync as it means that if it is interrupted for any reason, then you we restart it easily with very little cost. In another word, rsync is a safe copy. use rsync command below (Note that the trailing slash on /home and /homes/ is important) :
 rsync -avhW --no-compress --progress /home/ /homes/  
For another type of rsync, please read here.

4. Move home partition to /oldhome.
Move our /home partition to /oldhome. Use mv command like below:
 mv /home /oldhome  
5. Umount home and new partition directory then remount new partition directory.
Unmount /home and /homes directory. Then remount /dev/sda2 to /home like the following code (don't forget to create /home):
 umount /home  
 umount /homes
 mkdir /home
 mount /dev/sda2 /home
6. Edit fstab by adding new entry pointing to the new partition.
Add new entry to our fstab. here we add the following entry with the below line:
 /dev/sda2    /home      ext4    defaults     1  1  
7. Confirm that everything is okay, then delete /oldhome.
Confirm that everything is okay. Check if data is okay. Then reboot the system. After rebooting, recheck data then delete /oldhome. Delete /homes too because we don't need it anymore.

Now everything should be run okay.. :).


Proud to a Slacker... :D


reference : https://help.ubuntu.com/community/Partitioning/Home/Moving

0 comments:

Silahkan tinggalkan komentar anda: