How to Unmount Volumes

Unmounting a volume means making its filesystem inaccessible to the operating system, so it can’t be actively written to or read from. To protect data integrity, it’s best to unmount a volume before resizing or detaching it.

To unmount a volume, you need to know its mount point, which you can find with df.

sudo df --human-readable --print-type

The volume mount point will look something like volume-sfo2-01:

Filesystem     Type      Size  Used Avail Use% Mounted on
 . . . 
/dev/sda       ext4       99G   60M   94G   1% /mnt/volume-sfo2-01
 . . . 

Use umount to unmount the volume, making sure to substitute in its mount point.

sudo umount --verbose /mnt/mount_point

If the volume is busy, you’ll see output like this:

umount: /mnt/mount_point: target is busy
        (In some cases useful info about processes that
         use the device is found by lsof(8) or fuser(1).)

You can see if any processes are currently using the mounted filesystem by passing the mount point to lsof:

cd ~
sudo lsof +f -- /mnt/mount_point

If the command displays any output, you will have to stop the listed processes before unmounting the filesystem.

If the volume is safe to unmount, umount will return:

umount: /mnt/mount_point unmounted

If you will not be reattaching the volume, adjust the /etc/fstab file to remove any entries referencing the volume:

sudo nano /etc/fstab

You may also wish to remove the mount point if you will not be using it again:

sudo rmdir /mnt/mount_point

Once the volume is unmounted, you can safely proceed to resize or detach it.