Skip to main content

Mounting disks

Guide to formatting, mounting and permanently mounting disks (volumes) on the centron and ccloud³, including fstab configuration.

Formatting a disc

When you create a new volume, you must format it. Formatting a volume creates a file system on the volume and deletes all existing data. A volume only needs to be formatted once, when it is first created, as new discs do not have a file system.

Mounting a formatted disc

Every time you attach a volume to a ccloud³ VM, including the first time, you must mount it. Mounting a formatted volume adds the volume’s file system to the existing file hierarchy of the ccloud³ VM. You must mount a volume every time you attach it to a ccloud³ VM to make it accessible to the VM’s operating system.

To mount a formatted volume, first select a mount point – that is, the directory to which the disk’s file system is to be mounted. Once it has been mounted, you can access the files on the disk from there.

We recommend creating a new directory in "/mnt" as the mount point:

 sudo mkdir /mnt/example_mount_point 

Next, use mount to mount the volume’s file system at the mount point. We recommend using the same options as for automatic mounting, which are defaults,nofail,discard,noatime:

sudo mount -o defaults,nofail,discard,noatime /dev/disk/by-id/scsi-example /mnt/example_mount_point

Setting up persistent mounting

The /etc/fstab file contains static information about file systems that the operating system can mount, including those that are to be mounted automatically at boot time. You can add a line for the disk’s file system to mount it automatically when the ccloud³ VM boots. This ensures that the disk’s file system remains consistent even after reboots.

Each line in /etc/fstab represents a file system and consists of six fields separated by spaces:

  • fs_spec, the block device to be mounted. Use the /dev/disk/by-id identifier for the volume or partition.

  • fs_file, the mount point for the file system.

  • fs_vfstype, the file system type in lower-case letters, such as ext4 or xfs.

  • fs_mntops, the embedding options. We recommend the same options as for automatic embedding: defaults,nofail,discard,noatime.

Ultimately, the line you add to /etc/fstab should look like this, containing your volume’s identifier and the mount point:

/dev/disk/by-id/scsi-example /mnt/example-mount-point ext4 defaults,nofail,discard,noatime 0 2

Once you have edited the file, check whether /etc/fstab can be parsed and used:

findmnt --verify --verbose

This lists all parsing errors, runtime errors and warnings. Once you have rectified all the errors, you can use mount -a to mount the volume.