Attaching a Volume to an Instance

Run these commands on your instance to start using a volume.
Replace <TARGET>with the volume target, e.g. vdb and <DIR_NAME> with the name of the directory you want to mount it to.
Format volume (only needed once, e.g, if it's a new volume):
mkfs.ext4 /dev/<TARGET>
Create directory:
mkdir /mnt/<DIR_NAME>
Mount volume:
mount /dev/<TARGET> /mnt/<DIR_NAME>
Recommended: add volume to fstab (this will automatically mount the volume on every system startup):
echo "/dev/<TARGET> /mnt/<DIR_NAME> ext4 defaults 0 0" >> /etc/fstab
Last modified 1mo ago