Change /home directory to new Hard disk drive

activehari

New member
Joined
Oct 18, 2007
Messages
3
Hello,

Recently a new HDD with around 150Gb capacity was installed in one our server in addition to 66 gb hardisk which is almost full ,and the new hard disk is ready to be formatted and partitioned.

How can you move /home directory to this new HDD?

Below are the details.

*********************************
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 66G 60G 2.9G 96% /
/dev/sda1 99M 29M 66M 31% /boot
none 1013M 0 1013M 0% /dev/shm
/usr/tmpMnt 39M 15M 22M 41% /tmp
/dev/sdb1 147G 93M 140G 1% /home2
*********************************

I need all the data from from "/"' (/dev/sda3 66G 60G 2.9G 96% /) to be moved to /home2 (/dev/sdb1 147G 93M 140G 1% /home2)

Our requirement is that we need to move all the accounts under /home directory to /home 2. Will the old accounts be affected if we migrate from the /home to /home2 and also we need the new users to get added under the /home2. Will this be possible. Please help me out to get resolve this problem.

Regards
Raj
 
Code:
cp -rfp /home/* /home2
rm -rf /home
ln -s /home2 /home

If you want you can also edit:

/etc/default/useradd

change the HOME= variable to HOME=/home2
 
Not very handy though!

To do it the good way:

Move all the files to the new disk, umount /home, and mount your new harddrive as /home.

Then format and mount the other drive as you like :)
 
Changing the DirectAdmin /home mount point

Hi. I had a 2TB SATA RAID array and a 250GB ssd HDD which the centos is intalled on the SSD. I wanted to move the directadmin data to the SATA drive. So i did this (the home is mounted as default on : dev/mapper/centos-home):

umount home
mount dev/sdb1 /home

But now the Apache shows 403 forbidden error when i want to login to directadmin or visit the hosted websites.
 
Hello,

Will it fix?

Code:
chmod 711 [COLOR=#333333]/home
chown 0:0 [/COLOR][COLOR=#333333]/home
[/COLOR]/usr/local/directadmin/scripts/set_permissions.sh user_homes
service httpd restart

If it does not, then let us know what OS you run there. And what is written in apache error_log for a domain?
 
Hello,

Will it fix?

Code:
chmod 711 [COLOR=#333333]/home
chown 0:0 [/COLOR][COLOR=#333333]/home
[/COLOR]/usr/local/directadmin/scripts/set_permissions.sh user_homes
service httpd restart

If it does not, then let us know what OS you run there. And what is written in apache error_log for a domain?

Thanks! That fixed the error.
 
Hello,

Will it fix?

Code:
chmod 711 [COLOR=#333333]/home
chown 0:0 /home
[/COLOR]/usr/local/directadmin/scripts/set_permissions.sh user_homes
service httpd restart

If it does not, then let us know what OS you run there. And what is written in apache error_log for a domain?


Hello,
I copied my /home / /newhomessd with permissions.
But now it's time to umount /home disk from hdd and mount ssd to /home.

I run command umount /home

But it says umount /home target is busy

I tried to umount -f command, it did not work either.
I tried fuser -k /home command, it did not work again.

And I tried umount -l /home command. After that i stopped all services from directadmin. It somehow unmounted /home but /home folder stayed there as an empty folder. I couldn't remove or move it.

Can you or someone help me to figure out this issue. How can I unmount disk and replace /home folder.
 
you will not be able to umount /home on a live server with all services online.
You should reboot into single user mode, and do your actions there ( file copy etc.. )
then you will have to edit your fstab to reflect the new mount point for the next boot.

In case everything is already set on the new partition, simply edit fstab and reboot.
 
you will not be able to umount /home on a live server with all services online.
You should reboot into single user mode, and do your actions there ( file copy etc.. )
then you will have to edit your fstab to reflect the new mount point for the next boot.

In case everything is already set on the new partition, simply edit fstab and reboot.

So if I edit fstab now, is it done?

Now on fstab file there's UUID's.
I need to remove /home line and change newhdd to /home at there.
That will make job done i guess. Right?
 
don't remove the old entry, just comment it out with #, in case you need to rollback the change.
you can use the new partition UUID, or hardware path ,
it's basically the same if you don't change the physical location of the new drive, using UUID will allow you to have more flexibility in that regard.

you add a new line with the new drive , file system type and option.
 
Back
Top