1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Install a volume on an unmanaged Cloud server
This guide explains how to format then mount the volume dedicated to the storage of your data on your unmanaged Cloud server.
By default, unmanaged Cloud Servers are supplied with two volumes:
- 1 volume for the operating system of your choice (/dev/vda)
- 1 volume to store your data (/dev/vdb)
The volume for data storage (/dev/vdb) must be formatted then mounted by the customer.
1. SSH commands to format the storage volume
If you choose XFS, for example, it is necessary to install the appropriate tools (if they are not yet installed):
sudo apt install xfsprogs
It is then necessary to format the volume using the following SSH commands:
sudo mkfs.xfs -f /dev/vdb
And if you choose EXT4:
sudo mkfs.ext4 /dev/vdb
If necessary, you can format the volume with a different file system supported by your distribution.
2. Mounting the storage volumePlease note: if you mount your data volume in /home, you will no longer be able to log in to your server using your private key the next time you restart (because SSH will look for the keys in the ".ssh" file in the home (home folder) of the user and if the data volume is mounted in this folder, the keys are lost). As a result, it is necessary to copy the data to be kept first. For example, in root:
mount /dev/vdb /mnt/home
rsync -rlptgoDHAX /home/ /mnt/home/
mount /dev/vdb /home
What that means in order:
- you create a temporary folder
- you mount the volume on the temporary folder
- you copy the contents of the original "/home" folder to the root of the volume keeping the same rights, owner, group, etc. (please note: you might need to install the "rsync" bundle depending on the Linux distribution chosen)
- you dismount the volume from the temporary folder
- you mount the volume on the "/home" folder
- you delete the temporary folder
This way you should be able to mount the volume on "/home" while keeping the initial configuration which is installed. We nevertheless recommend that you create a password for "root" so that you do not lose control if you should make a mistake. The password can be removed afterwards.
Alternative solution: not mounting in "/home"...
This is a standard location to mount the data volume because it is generally in "/home" that users will work and, in particular, store their data. A user without special rights will usually be limited to their "/home/user" directory. It is possible to indicate another default directory for a user (but the configuration will no longer be "standard").
Another alternative solution: automatically mounting the volume on startup
A mount does not withstand a restart. If you do not want to make the change permanent, you can add your volume to the file "/etc/fstab". Debian documents on this matter: https://wiki.debian.org/fr/fstab
3. SSH commands for mounting the storage volume
sudo mount /dev/vdb point_de_montage
Help for the SSH connection
For example, to mount the data volume in the /home directory of your Cloud server, the command to perform is the following:
sudo mount /dev/vdb /home
Find out more
A guide presenting these steps and explaining the deployment of a managed server with Laravel Forge in detail is available by clicking here.