SOLVED Relocating mail folder to save disk space

GDev

Member
May 5, 2016
9
0
1
Finland
cPanel Access Level
Root Administrator
Hi,

I'm running out of root disk space on my system and I'd like to move one /home/user/mail folder to another partition to free some space.

I tried that by creating a symbolic link pointing from /home/user/mail to /mnt/stuff/mail and it seemed to work only half way. I can read mail, but when sending email with Thunderbird IMAP, it says that saving message to outbox failed. I've ensured that the user has write permissions to the symlinked folder (i.e. "cd mail", "touch file" is able to create file in the new folder normally).

Any ideas why it failed and how to make this work? Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
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.
 
  • Like
Reactions: GDev

GDev

Member
May 5, 2016
9
0
1
Finland
cPanel Access Level
Root Administrator
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:

Code:
[email protected] [/]# 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)
Code:
[email protected] [/]# 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
Code:
[email protected] [/]# 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
Code:
[email protected] [/]# 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.
 
Last edited:

24x7server

Well-Known Member
Apr 17, 2013
1,911
96
78
India
cPanel Access Level
Root Administrator
Twitter
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 /<NewLVM partition>
# mv /home/user/mail /home/user/mail_BK
# mount /<NewLVM> /home/user/mail

Give it a try..
 
  • Like
Reactions: GDev

GDev

Member
May 5, 2016
9
0
1
Finland
cPanel Access Level
Root Administrator
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 /<NewLVM partition>
# mv /home/user/mail /home/user/mail_BK
# mount /<NewLVM> /home/user/mail

Give it a try..
That is a good idea. Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,227
463
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.