Skip to main content

Relocating mail folder to save disk space

Comments

10 comments

  • cPanelMichael
    Hello, Using a symbolic link for email storage isn't supported, but you could configure the additional partition for accounts and move the entire account to that partition via the "Rearrange an Account" option in WHM: Rearrange an Account - Documentation - cPanel Documentation Additionally, to configure another partition as the destination for accounts, you'd configure the "Additional home directories matching the following value will also be used for new home directory creations" value in "WHM Home >> Server Configuration >> Basic WebHost Manager" Setup": Basic WebHost Manager Setup - Documentation - cPanel Documentation Thank you.
    0
  • GDev
    Thanks Michael! Sounds like a solution. (See edit below) I tried that but ran into trouble (new home dir does not seem to be detected). The Rearrage feature says "Sorry, there is only one usable partition detected on this machine matching "home"". The Basic settings are set to "/home" and additional names as "home" (tried "home2", "/home2" too, same problem). Some sys info:
    root@vps [/]# mount proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) devtmpfs on /dev type devtmpfs (rw,nosuid,size=1019784k,nr_inodes=254946,mode=755) securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755) tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755) cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd) pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime) cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct,cpu) cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory) cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls) cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio) cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event) cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb) configfs on /sys/kernel/config type configfs (rw,relatime) /dev/vda1 on / type ext4 (rw,relatime,quota,usrquota,data=ordered) systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=33,pgrp=1,timeout=300,minproto=5,maxproto=5,direct) hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime) mqueue on /dev/mqueue type mqueue (rw,relatime) debugfs on /sys/kernel/debug type debugfs (rw,relatime) /dev/sda on /home2 type ext4 (rw,relatime,discard,data=ordered) tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,size=205008k,mode=700)

    root@vps [/]# df -kh Filesystem Size Used Avail Use% Mounted on /dev/vda1 40G 31G 7.3G 81% / devtmpfs 996M 0 996M 0% /dev tmpfs 1002M 0 1002M 0% /dev/shm tmpfs 1002M 8.6M 993M 1% /run tmpfs 1002M 0 1002M 0% /sys/fs/cgroup /dev/sda 59G 53M 56G 1% /home2 tmpfs 201M 0 201M 0% /run/user/0

    root@vps [/]# cat /etc/fstab # # /etc/fstab # Created by anaconda on Tue Jul 8 23:01:42 2014 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # LABEL=DOROOT / ext4 defaults,usrquota 1 1 /swapfile swap swap sw 0 0 /swapfile2 swap swap sw 0 0 /dev/disk/by-id/scsi-0DO_Volume_homedirvolume60gb /home2 ext4 defaults,nofail,discard 0 0

    root@vps [/]# ls -l |grep home drwx--x--x. 15 root root 4096 Mar 24 01:20 home/ drwx--x--x 3 root root 4096 Mar 24 00:53 home2/
    Please let me know if you got any idea what's wrong with this. Thanks! EDIT: I checked the relocate again today and now the new home appears in the list. I just had to wait overnight. Would be nice if the necessary waiting time would be specified in documentation to avoid confusion.
    0
  • GDev
    Here are my settings: 45975 As told, tried also home2 and /home2 on the second option.
    0
  • 24x7server
    Hi, I would suggest a different way. If you have a new partition that is unused, create LVM on it. create a small separate partition, move your mails to it and mount this new LVM to the exact location where your account is having the mail directory, i.e., # rsync -av --progress /home/user/mail / # mv /home/user/mail /home/user/mail_BK # mount / /home/user/mail Give it a try..
    0
  • GDev
    Hi, I would suggest a different way. If you have a new partition that is unused, create LVM on it. create a small separate partition, move your mails to it and mount this new LVM to the exact location where your account is having the mail directory, i.e., # rsync -av --progress /home/user/mail / # mv /home/user/mail /home/user/mail_BK # mount / /home/user/mail Give it a try..

    That is a good idea. Thanks!
    0
  • cPanelMichael
    EDIT: I checked the relocate again today and now the new home appears in the list. I just had to wait overnight. Would be nice if the necessary waiting time would be specified in documentation to avoid confusion.

    Hello, There should be no wait period on using a new partition. It's possible the nightly cPanel update script restarted cPanel which corrected the issue. Thank you.
    0
  • santrix
    Sorry to resurrect this post, but I would be most grateful if cPanelMichael might comment on the solution to use bind mounts? I see there is a feature request for this idea but it seems to have been ignored by cpanel, which makes zero sense to me, as the Linked Nodes solution seems an insanely complex alternative and moving the whole account to cheap slow media also seems unsatisfactory.
    0
  • cPRex Jurassic Moderator
    @santrix - what question did you about about the bind mount option?
    0
  • santrix
    @santrix - what question did you about about the bind mount option?

    Specifically, what pitfalls do cpanel know of if a user's ~/mail directory was moved to a bind mount pointing to a partition on another device.
    0
  • cPRex Jurassic Moderator
    Thanks for the clarification. That isn't something we test on our side, so I don't have a good way to answer that for you. My best recommendation would be to try setting up a suitable test environment and seeing how it behaves.
    0

Please sign in to leave a comment.