1

Topic: How to move mailbox folders to a different volume

What is the best method to move the /var/vmail folder to a new volume for Postfix and Dovecot after I've successfully installed iRedMail?  I have a server with a 128GB SSD and 4 1TB HDDs (setup as a RAID-5) and I would love to be able to have mailboxes stored on the new RAID-5 volume (mounted in /media/3TB).  I know I can accomplish this by re-installing but I'd rather not since I have been successful in following all of the installation guides so far.  I have not yet deployed this e-mail server to production so I have a lot of flexibility and there isn't really mail to speak of to worry about yet.  I have two accounts so far- a postmaster account and a personal account.  And again, I originally just went with the /var/vmail default location during installation which I would now like to change.  Thanks again for a great e-mail server platform!  Once I can get this up and running and tested, I'll be moving many of my clients over and looking at the Pro edition.  Thanks so much!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2 (edited by goodcoffee 2021-01-16 04:26:22)

Re: How to move mailbox folders to a different volume

veriatech wrote:

What is the best method to move the /var/vmail folder to a new volume

I would suggest that you copy the existing /var/vmail contents into your big volume, currently mounted at /media/3TB.  Pay attention to keep ownership and permissions exactly as they are on /var/vmail/

Then umount the volume from /media/3TB and mount it instead at /var/vmail.  Remember to update your /etc/fstab to ensure it gets mounted at boot time in future.

This is just a high-level description. I don't know what OS you're on, and some of the commands you'd use will vary slightly from OS to OS.

Good luck!  Hope that helps.

3 (edited by veriatech 2021-01-16 04:35:34)

Re: How to move mailbox folders to a different volume

goodcoffee wrote:
veriatech wrote:

What is the best method to move the /var/vmail folder to a new volume

I would suggest that you copy the existing /var/vmail contents into your big volume, currently mounted at /media/3TB.  Pay attention to keep ownership and permissions exactly as they are on /var/vmail/

Then umount the volume from /media/3TB and mount it instead at /var/vmail.  Remember to update your /etc/fstab to ensure it gets mounted at boot time in future.

This is just a high-level description. I don't know what OS you're on, and some of the commands you'd use will vary slightly from OS to OS.

Good luck!  Hope that helps.

Great advice!  Thank you!  I'll give this a go.  FYI, I am on Ubuntu Server 20.04.  I followed these instructions https://www.linuxbabe.com/mail-server/u … ail-server to a T and everything went very smoothly, including the installation of all the SSL certs, etc.  Guessing I'll also need to stop the Dovecot & Postfix processes before making the folder mount switch.  I've already tried editing the conf files for Dovecot & Postfix to point to the new folder mount but it didn't seem to make a difference.  But this method you advise seems feasible.  I'll update shortly.  Worse case is I re-install everything and this time I'll mount the larger volume BEFORE I install iRedmail and point to it during install... but again, would rather not go to that extreme.  Thank you!

4

Re: How to move mailbox folders to a different volume

Yes, you'll want to stop every process that touches /var/vmail.
Easiest way may be to just boot to single user mode, then make sure your mounts are all in place, before starting the copy.
You could look at cp -pr   as a probable way to accomplish that.  Check your man page for the options.

Good luck to you

5

Re: How to move mailbox folders to a different volume

goodcoffee wrote:

Yes, you'll want to stop every process that touches /var/vmail.
Easiest way may be to just boot to single user mode, then make sure your mounts are all in place, before starting the copy.
You could look at cp -pr   as a probable way to accomplish that.  Check your man page for the options.

Good luck to you

Yipee! It WORKED!  Be it known I also have Webmin installed on this box.  So... the first thing I did was stop both the Dovecot & Postfix services via Webmin.  Then, also inside of Webmin, I remounted /media/3TB to /var/vmail, but before I did that, made the copy of vmail over to the larger volume, and also assigned vmail user with RW perms.  Then, I executed the remount, restarted both the Postfix & Dovecot services and walah!  All mail now going to the new /var/vmail folder located on the larger volume!  Now cooking with gas!  Oh, the possibilities now!!!  Thanks so much goodcoffee for your advice.

FYI, I'm a long time sysadmin across many platforms, including Windows NT (yep, I go WAY back), Win Server, Red Hat Linux and now Ubuntu Server.  I am currently on a "tear" to start shifting many of my online hosted assets (websites, e-mail, etc.) over to Linux based platforms due to security reasons.  I just think Linux offers more security and control... sure it's a lot harder and requires more brain cells, but... worth it imho.  Thanks again, goodcoffee!

6 (edited by goodcoffee 2021-01-16 05:47:58)

Re: How to move mailbox folders to a different volume

Glad to hear it went smoothly, @veriatech!
After you're comfortable that all's well, (day? week?) take another short outage, boot to single user, unmount /var/vmail, and then delete the old stuff that you copied out, leaving an empty directory /var/vmail. 

N.B.  Just be sure you are where you think you are before you hit the big Delete.  Measure twice, cut once.

That will recover a bit of free space for your base disk, and avoid the "someday" condition of starting the server without the mount in place, and the subsequent hair-pulling you'd do trying to figure out where so much of your mail and user setups went smile  You might go so far as to leave a single README.DUMMY file in the underlying /var/vmail to get your attention if the mount is missing.

Good job committing to learn lots of new stuff.  See today's Dilbert smile  https://dilbert.com/strip/2021-01-15

-gc

7

Re: How to move mailbox folders to a different volume

goodcoffee wrote:

Glad to hear it went smoothly, @veriatech!
After you're comfortable that all's well, (day? week?) take another short outage, boot to single user, unmount /var/vmail, and then delete the old stuff that you copied out, leaving an empty directory /var/vmail. 

N.B.  Just be sure you are where you think you are before you hit the big Delete.  Measure twice, cut once.

That will recover a bit of free space for your base disk, and avoid the "someday" condition of starting the server without the mount in place, and the subsequent hair-pulling you'd do trying to figure out where so much of your mail and user setups went smile  You might go so far as to leave a single README.DUMMY file in the underlying /var/vmail to get your attention if the mount is missing.

Good job committing to learn lots of new stuff.  See today's Dilbert smile  https://dilbert.com/strip/2021-01-15

-gc

Thanks for the followup, @goodcoffee!  I actually failed to mention that I have already deleted the original vmail folder.  I did this AFTER I copied the vmail folder over to the larger volume and before the mount.  The disk space reclaimed was negligible since this is a brand new e-mail server with only a couple of accounts.  I'm paving the way for the future here!  smile  I also just rebooted the server and again, all seems to be performing well and as expected!

Thanks for sharing the daily Dilbert!  Bookmarked!  smile  Again, appreciate your help @goodcoffee!

8

Re: How to move mailbox folders to a different volume

Thanks for sharing, guys. smile