How should I change the home directory for one virtual server?

Hi Guys , I’m using a dedicated server on which the partition status is as below
2tb mounted on / (root)
4tb on /home2 !!!

Now I have created one virtual server named dl.mysite.com and its home directory is /home/dl.mysite.com
I want a new virtual server named dl1.mysite.com and I want the home directory to be /home2/dl1.mysite.com .
It means for the second virtual server , I need home directory to be /home2/dl1.mysite.com . because it has 4tb mounted on it .
How can I change home directory from /home/dl1.mysite.com to /home2/dl1.mysite.com ?

Howdy,

Since the suexec program is setup to use /home for running programs, and Virtualmin is configured to use that for all new users – my recommendation would be to mount your new drive on /home, rather than home2, and to move everything already in /home onto your new drive.

Changing the home directory isn’t simple to do, and unfortunately there really isn’t a good way to have two different home directories like you described.

-Eric

Hi Eric , Is there a way to completely change the home directory to home2 ? I mean both dl.mysite.com and dl1.mysite.com on /home2? for some reasons I can’t reinstall linux and config everything from the beginning .

Howdy,

Well, you wouldn’t need to start over from the beginning, you’d just need to copy files from /home to /home2, then update your /etc/fstab to make /home2 mount instead on /home.

What distro/version are you using though?

-Eric

Hi there , Im using :
Webmin version 1.710
Virtualmin version 4.11.gpl GPL
and linux centos 6.5 x64 bit

look , I already have a virtual server on /home named dl.mysite.com and I can upload files via ftp and there is no problem !
But I need a new virtual server on /home2 named dl1.mysite.com and I need a ftp on it so I can upload my files in it . This is a storage server , doesnt really matter what happens if I use /home2 for my new virtual server because Im the only one who has access to this server .

Hi,

If your only going to access it via FTP, I believe you would be fine, however you wouldn’t be able to access it via a web browser due to the way suexec works (for security purposes). If that is okay with you then you would be fine, however I can’t figure out a way to specify the home directory for a virtual server. You might need to create a new Unix user and then add a proftpd virtual server manually. I’m not sure of a better way. Let you know if I come up with one.

Eric was suggesting since your /home2 device was bigger, then it would most likely be easier to move existing /home servers to the new drive and remount /home2 as /home. That would be the easiest solution perhaps.

-Dustin

–EDIT–

Found how you can specify the new home directory. Under the server you want to change, select “Server Configuration” > “Change domain name”. From that screen, leave all options to keep things as they are, but specify a new home directory using the appropriate option.

Hi Dustin , I already did change domain name home directory , but it doesnt affect that virtual server because when I use Edit server option , the home directory is still /home/dl1.mysite.com .

I asked my server configer about the reason he used this stupid partitioning ! He answered : " You asked for 6tb usable with raid1 , This was the only way to give u so ! If I mount 4tb on ur home directory and 2tb on root , You will lose that 2tb and it would be useless "

Hi,

Oh, I find it strange it still shows the home directory on /home, did you move the files using Virtualmin or via a mv command?

Also, this is my understanding of your partition layout, could you fill in the blanks/correct me if I’m mistaken:

/ - 6TB (Drive 1)
/home - 4TB of 6TB (Drive 1)
/home2 - ?

-Dustin

It’s a SX60 server from Hetzner Online datacenter which has 4*3.5 TB hard drives , When Using Raid1 and linux U get something like 6TB usable on the server but if you want raid1 to work perfect , U cant allocate all 6tb to root ! that’s why my configer gave 2tb to / (root) and 4 tb to /home2 ! he says if I mounted that 4tb on /home , the 2 tb on root would be useless because files in /home are counted in root I guess . So instead of /home he gave 4tb to /home2 . now the question is how can I create a virtual server in /home2 without hurting the one in /home . :smiley: Im sorry it’s really complicated for me , I dont know if u get what i say :stuck_out_tongue:

I must say I am confused about how your system was configured. I don’t understand why he said that. To me, it doesn’t fully make sense to me. Sorry I can’t be of much more help. Hopefully you find the answer you are looking for. :slight_smile:

-Dustin

thanks , i will look forward to any answers possible , but at the end if i cant figure something out , i will reinstall linux myself

Howdy,

While I don’t really recommend trying to move things to /home2, and it seems that it would be relatively straight forward to move /home2 over to /home – it’s actually not really possible using CentOS.

With CentOS, the Apache suexec program is hard coded to use /home for running scripts. It won’t actually work to use a different path. Suexec would throw an error if it attempted to run a PHP script within /home2.

I don’t think you need to reinstall though.

It should actually be possible to simply copying what you have in /home over to /home2, unmount /home2, and then mount it on /home.

-Eric

In your case I would remove the 2nd /home2 partition and use partitioning as follows:
2TB /
4TB Partition 1GB (how much you need for your site) /home/site1
4TB Partition 500GB /home/site2/

I would create the partitions prior to creating the actual sites. This way you use the space on your 2TB partition for all software and sites if you like and the 4TB for your more heavy sites.
I believe you can increase the partition fairly easily.
If you will be using LVM partitionning this should be fairly easy:
http://www.linuxuser.co.uk/features/resize-your-disks-on-the-fly-with-lvm