Can I mount a disk to a domain?

I setup my Mailinabox in VPS.
Can I buy a storage disk and mount on one domain?

I will assume this is for email and web storage?

These steps have not been test but with some slight modification should work. Note though that some stuff wont be moved (Like SSL cert, and nginx settings files, etc)

NOTE: This is a HUGE unsupported modification, untested, never used elsewhere (AFAIK) Please BACKUP BEFORE DOING ANYTHING! I AM NOT RESPONSIBLE FOR LOST DATA.

1. Mount the external disk according to your VPS providers instructions (And make sure it auto-mounts on reboots!)
2. Do something like the following (be sure to change paths etc to match your server!)
    ## Avoid sudo here, just for simplicity login as root
    ## Stop system services so we do not crash anything
    systemctl stop mailinabox && systemctl stop dovecot && systemctl stop postfix && systemctl stop nginx

    ## Make folders on the external disk for the domain, not we are only moving www, mail, and cloud!
    mkdir -p /mnt/disk1/
    mkdir -p /mnt/disk1/
    mkdir -p /mnt/disk1/
    ## Move data over to the external disk (Be mindful of where slashes are placed! Format as I did!)
    mv /home/user-data/mail/ /mnt/disk1/
    mv /home/user-data/www/ /mnt/disk1/
    ## Cloud data is trickier. Move each user one at a time: (Be mindful of where slashes are placed! Format as I did!)
    mv /home/user-data/cloud/ /mnt/disk1/
    mv /home/user-data/cloud/ /mnt/disk1/
    ## Now we symlink back to the original spot (Again, watch your slashes!)
    ln -s /mnt/disk1/ /home/user-data/mail/
    ln -s /mnt/disk1/ /home/user-data/www/
    ## Same for each user: (Again, watch your slashes!)
    ln -s /mnt/disk1/ /home/user-data/cloud/
    ln -s /mnt/disk1/ /home/user-data/cloud/
    ## Reboot when done

In theory, this should work as expected, but please test and make sure you change the commands to fit your domain, server, etc.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.