Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Move mail folder to other partition

  1. #1
    Registered Member
    Join Date
    May 2011
    Posts
    11

    Default Move mail folder to other partition

    Hello.

    I am the latest Centos distro and the latest cPanel version.

    As you know all users have their stuff in the /home folder.

    Now, I have /home/user/mail. The "mail" folder contains all the e-mail accounts listed under that user account.

    However, I want to change the location of this to another partition, let's say /usr or /var for example.

    Would a symlink work with this ?

    I am in great need of disk space and the /home partition only has 50gb as /usr has 200gb.

    Thank you very much.

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,609
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Move mail folder to other partition

    Most partitioning schemes have /home with the most space, especially cPanel-based machines. Why precisely was /usr given 4x the disk space over /home partition?

    Maybe you would want to have some accounts writing to /usr instead such as /usr/home for new accounts. If you create an area for new accounts to go there, then you should be able to use WHM > Basic cPanel & WHM Setup area for this section:

    Additional home directories matching the following value will also be used for new home directory creations. (Leaving this value blank disables the feature.) This option only takes one value.

    Examples: “home” matches /home, /home2, /newhome, /usr/home, /anythingwith/homeinit
    To have new user accounts put into /usr/home instead of /home due to it having more disk space. It would be better to have a secondary partition (/usr/home) being used for the new accounts over trying to move existing data and symlink it in /home
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Registered Member
    Join Date
    May 2011
    Posts
    11

    Default Re: Move mail folder to other partition

    Thank you very much for you kind answer.
    Everything you said is correct and known to me. Unfortunately I don't have a choice. I only have 2 accounts and never will have more than these 2. Thing is the mail folder is getting bigger and bigger and I have only two choices (?):
    somehow increase the free space on /home partition by taking space from /usr and/or /var (each of them is of 200GB)
    OR
    move the /home/user/mail folder to one of /usr or /var partition and trick cPanel with a symlink.

    Any suggestions would be much appreciated.

    Thank you.

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,609
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Move mail folder to other partition

    If you are going to do this, please ensure that you have full backups before trying to move the folder to another partition. I cannot say the results as I've never tried it previously. If you have full backups, you can at least restore the account or folder if needed.

    I did do some basic testing doing the steps below by moving the mail folder for a testing domain and then symlinking it back. After performing those steps, I was still able to create new email accounts, log into webmail interface and send a test email from Roundcube. So those areas appear to still function per the very quick test I performed.

    For moving it, all you'd do is the following (please do not create the email folder beforehand and let it be created with the move command):

    Code:
    mv /home/username/mail /usr/username-mail
    A move normally maintains the permissions, so you should then be able to do the symlink:

    Code:
    cd /home/username
    ln -s /usr/username-mail mail
    Please replace username in all instances to the cPanel account username.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  5. #5
    Registered Member
    Join Date
    May 2011
    Posts
    11

    Default Re: Move mail folder to other partition

    Very comprehensive and helpful. I will engage in this hopefully this weekend. Thank you so much (this reminds me why I paid 400+ bucks for this tool).

    Will test this and will let you know.

    Thank you !

  6. #6
    Registered Member
    Join Date
    May 2011
    Posts
    11

    Default Re: Move mail folder to other partition

    So, here's my reply as promised.
    I am able to send/receive e-mails after moving the mail folder as instructed above.
    note that I issued the command
    Code:
    /sbin/service exim stop
    before the actual mv command and
    Code:
    /sbin/service exim start
    after it completed.
    Lots and lots of e-mails so patience was my ally. I opened up another SSH instance and monitored the transfer with 'df' command.

    So, in addition to your tests I add mine and I confirm that so far all is good.

    Thank you very much again !

  7. #7
    Registered Member
    Join Date
    May 2011
    Posts
    11

    Question Re: Move mail folder to other partition

    Hello again.

    After almost one year now... It has come to my attention, now that I am migrating the user-accounts from this server to a new one, that the e-mails weren't transfered.

    Also, neither the backup process that is built-into cPanel has ever backed up the e-mails because they were located in /usr/username-mail... not in /home/username/mail (as they should be by default)...

    Are there any chances for me to backup the e-mails with the built-in backup function (that apparently doesn't know how to follow the @mail symlink in /home/username/) or should I write a script to just tar them where they are and then rsync them on a backup server ?

    Also, as I was saying, I am now migrating the account on a new server... of course the migration process took care of everything except for the e-mails... (sheeeesh ! lots of hassle for that first partitioning mistake).

    So, I've let the migration function finish, everything went smooth and I did the same steps like in the above posts with symlinks and now I am using rsync to copy the /usr/username-mail from the old server to the new /usr/username-mail on the new server...
    Should I expect this to succeed properly ? (119GB transfer gave me the time to write this)

    Thanks !

  8. #8
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,609
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Move mail folder to other partition

    Backups will not follow symlinks, so this would not be backed up. It would have been more advisable (as originally suggested) to have set the accounts to /usr/home and have them create there without using symlinks. As you are now doing, you'd manually copy over those mail folders to the new machine. I would suggest having mail collect in the default /home location on the new machine rather than continuing to use this setup provided you have sufficient space in /home on this server
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  9. #9
    Registered Member
    Join Date
    May 2011
    Posts
    11

    Default Re: Move mail folder to other partition

    I understand. Well, the rsync has finished successfully and all the e-mails were copied without any problems. I've set up a cron job that triggers a zipping of the mail folder and then uploads the tar to a remote backup server. Everything works as expected.

    However, is there a way to increase the space on a partition by taking up space from another one ? I know this is possible in Windows using numerous tools but I don't know if this is possible in linux. I understand that ext3 can support live resizing... would this work with the appropriate tool ?


    Thanks.

  10. #10
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,609
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Move mail folder to other partition

    You can attempt to resize a partition using space from another partition. The most typical type of resizing is for /tmp partition. I cannot really recommend how to do it, since I wouldn't recommend resizing any partition other than /tmp on a production machine.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  11. #11
    Registered Member
    Join Date
    May 2011
    Posts
    11

    Default Re: Move mail folder to other partition

    I see... I wanted to resize /home (currently 200GB) and take size space from /usr (1TB)... Thank you.

  12. #12
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,609
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Move mail folder to other partition

    On a machine currently in production with active accounts? If so, again I cannot recommend doing that.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  13. #13
    Registered Member
    Join Date
    May 2011
    Posts
    11

    Default Re: Move mail folder to other partition

    Yes... I'm afraid so... I will seek some advice in the Centos forums... Perhaps they have met this situation before and can advise me how to do it...

  14. #14
    Registered Member
    Join Date
    Jan 2012
    Posts
    15
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Move mail folder to other partition

    Did you ever get around to doing this? I need the opposite help. I need to move away space from my massive /home folder to the /usr folder.

    Code:
    Filesystem    Type    Size  Used Avail Use% Mounted on
    ...
    /dev/sda5     ext3    9.7G  2.6G  6.7G  28% /
    /dev/sda7     ext3    152G   16G  128G  11% /home
    /dev/sda3     ext3    9.7G  9.3G     0 100% /usr
    ...
    /usr/tmpDSK   ext3    2.0G  473M  1.5G  25% /tmp
    I want to move some space from that /dev/sda7 ("/home") into the /usr folder.

    What's a good way to do this? How do I ensure that the "free" part of the /home folder is given away to the /usr folder?

    Thanks!

  15. #15
    Registered Member
    Join Date
    May 2011
    Posts
    11

    Default Re: Move mail folder to other partition

    Hello,

    I didn't had the time to work on this yet, but instead I used a 'work-around' with symlinks to 'trick' the system and buy me some more time until I will have the time to put down the box and try a partition resize.

    Sorry I can't help you more now.

Page 1 of 2 12 LastLast

Similar Threads

  1. Move certain DB to different partition
    By blogbytes in forum Database Discussions
    Replies: 1
    Last Post: 10-16-2013, 10:55 AM
  2. Move Partition
    By popeye in forum General Discussion
    Replies: 2
    Last Post: 06-19-2013, 02:06 PM
  3. How to move the domlogs to another partition?
    By konrath in forum General Discussion
    Replies: 1
    Last Post: 08-14-2010, 02:13 AM
  4. Move Users from one to another partition
    By TimVR in forum General Discussion
    Replies: 1
    Last Post: 08-28-2008, 11:21 AM
  5. Move sub-domain to another partition
    By Giorgi in forum General Discussion
    Replies: 0
    Last Post: 04-27-2007, 04:56 PM
bargain