Volumes are network-based block devices that provide additional data storage for Droplets. You can move them between Droplets, create disk images of them, and resize them at any time.
Unmounting a volume makes its filesystem inaccessible to its Droplet’s operating system. This means the OS can’t write to or read from the volume. You should unmount volumes before resizing or detaching them to protect data integrity.
There are three steps to unmounting a volume:
Get the volume’s mount point with df
if you don’t already know it:
sudo df --human-readable --print-type
The mount point looks like /mnt/volume-sfo2-01
:
Filesystem Type Size Used Avail Use% Mounted on
. . .
/dev/sda ext4 99G 60M 94G 1% /mnt/volume-sfo2-01
. . .
Make sure the volume isn’t in use. If you try to unmount a volume while it’s in use, you get a target is busy
error, so check if any processes are using the mounted filesystem with lsof
:
sudo lsof +f -- /mnt/use_your_mount_point
Stop any listed processes.
Unmount the volume with umount
.
sudo umount --verbose /mnt/use_your_mount_point
Including the --verbose
flag makes the command output /mnt/your_mount_point unmounted
when it executes successfully. Otherwise, umount
is silent on successful execution.
If you plan not to reattach the volume in the future, you can do some additional cleanup:
Edit /etc/fstab
to remove any entries referencing the volume.
Delete the mount point:
sudo rmdir /mnt/use_your_mount_point
Once the volume is unmounted, you can safely resize or detach it.