This article provides step-by-step instructions for creating and mounting a filesystem on an Ubuntu instance. It also covers configuring automatic mounting after instance reboots.
Filesystem Creation
1. Create a Filesystem
Login to the console dashboard.
Navigate to the 'Filesystems' section from the left sidebar.
Click on 'Create Filesystem' on the right side of the page.
A new page will open where you can configure your filesystem:
- Location: Select the location for the filesystem.
- Type: Choose the filesystem type.
- Name: Provide a name for your filesystem.
- Description: Optionally, provide a description for your filesystem.
- Size: Specify the size of the filesystem.
Once you have filled in the required information, click Create Filesystem.
2. View Filesystem Details
- After the filesystem is created, click on it to view its details.
- In the 'Filesystem details' section, you will find all relevant information about it, such as its name, location, type, ID, mount endpoint range, and mount base path.
Mounting the Filesystem
3. Launch an Ubuntu Instance with Pre-Installed vastnfs
- Create an instance using the 'Ubuntu ML' image, as it includes the
vastnfs
package. - Once the instance is up and running, access it via SSH.
4. Update the System and Create a Directory for Mounting
To ensure the instance is up-to-date and to create a directory for mounting the filesystem, execute the following commands:
sudo apt update # Update the system packagessudo mkdir -p /mnt/my_storage # Create a directory to mount the filesystem
Note: You can replace /mnt/my_storage with a custom directory name of your choice.
5. Mount the Filesystem
To mount the filesystem, use the following command:
sudo mount -o proto=tcp,vers=3,nconnect=16,spread_writes,spread_reads,remoteports=10.24.11.10-10.24.11.48 10.24.11.40:/Mount_base_path /mnt/my_storage
- Replace mount endpoint
10.24.11.40, it
should be one from the range 10.24.11.10 - 10.24.11.48. - Replace
/Mount_base_path
with the base path you find in the 'Filesystem details' of your Filesystem. - Replace
/mnt/my_storage
with the directory you created earlier. - Once the command is executed, the filesystem will be mounted to the specified directory. You will get an output like the one shown in the image.
6. Verify the Mount
To confirm the filesystem is mounted correctly, run:
df -h
The mounted filesystem should be displayed in the output.
Configuring Auto-Mounting
7. Configure Automatic Mounting After Reboot
To ensure that the filesystem automatically mounts when the instance reboots, you need to modify the /etc/fstab
file.
Open the
/etc/fstab
file with a text editor:sudo vim /etc/fstab
- Add the following entry, replacing the placeholders with your specific details:
- <mount_endpoint>: The endpoint, e.g.,
10.24.11.40
. - <mount_base_path>: The base path from the 'Filesystem details'.
- <mount_point_in_the_instance>: The directory where the filesystem is mounted, e.g.,
/mnt/my_storage
.<mount_endpoint>:<mount_base_path> <mount_point_in_the_instance> nfs defaults 0 0
- <mount_endpoint>: The endpoint, e.g.,
- Example entry:
10.24.11.40:/ac140630-9867-3c8f573ad8ff /mnt/my_storage nfs defaults 0 0 |
Save and exit the editor.
Now, when you stop and start the instance again, the filesystem will automatically mount.