Skip to content
Log In Sign Up info@muvcloud.com

Mount a Drive Now

lsblk -f
sudo mkdir -p /mnt/data
sudo mount /dev/vdb1 /mnt/data
findmnt /mnt/data

Replace /dev/vdb1 with your partition. mount detects the file system type by itself, and findmnt confirms where it is mounted. If lsblk -f shows no file system on the disk, it has to be formatted first, which erases it; see how to format a disk in Linux.

Find the Device and Its UUID

lsblk -f
sudo blkid

lsblk -f shows every disk and partition with its file system, label, UUID, and current mount point. blkid prints the UUID and type of each one. Device names such as vdb1 or sdb1 can change when disks are added or reordered; the UUID belongs to the file system and stays the same.

Choose a Mount Point

A mount point is an ordinary folder. Common places are /mnt/data, /srv, or a folder such as /var/backups. Use an empty folder: files already in it are hidden while the disk is mounted there and come back after unmounting. ls -la shows whether it is empty.

Useful Mount Options

OptionWhat it does
-o roMounts read-only
-o noexecBlocks running programs from it
-o loopMounts an image file such as an ISO
-t xfsNames the file system type
-o remount,rwChanges options on a mounted disk

Unmount a Drive

sudo umount /mnt/data

The command is umount, without the first n. If it answers that the target is busy, a program or a shell is still using the folder, often your own session sitting inside it. Find it:

sudo lsof +f -- /mnt/data
sudo fuser -vm /mnt/data

Change out of the folder and stop the listed program, then unmount again.

Mount at Every Boot with /etc/fstab

A wrong line in /etc/fstab can stop the server from booting, so keep a copy of the file and test every change before you reboot:

sudo cp /etc/fstab /etc/fstab.bak
sudo nano /etc/fstab

Add one line, with the UUID from blkid:

UUID=your-uuid  /mnt/data  ext4  defaults,nofail  0  2
  • Fields: device, mount point, file system type, options, dump flag, and check order.
  • nofail: on a data disk, lets the boot continue if the disk is missing instead of stopping in emergency mode.
  • Check order: 1 is for the root file system only; use 2 for an ext4 data disk and 0 for XFS, whose fsck step does nothing at boot.

Then test:

sudo findmnt --verify
sudo systemctl daemon-reload
sudo umount /mnt/data
sudo mount -a
findmnt /mnt/data

findmnt --verify checks the syntax, and mount -a mounts everything in the file, so an error shows now rather than at the next boot.

Ownership After Mounting

The folder you see after mounting is the top of the disk's file system, not the empty folder you created, and on a new ext4 or XFS disk it belongs to root. Set the owner after the disk is mounted:

sudo chown deploy:deploy /mnt/data

ext4 and XFS store this ownership on the disk. File systems without Linux permissions, such as FAT, take the owner from mount options like uid= and gid= instead.

If the Server Stops at Boot

If a mount fails at boot without nofail, the server stops in emergency mode. Open the console in your provider's control panel, log in, and comment out the line in /etc/fstab or restore the copy, then reboot. The checks before and after a restart are in how to reboot a Linux server, and free space on the new disk is shown by df -h, as in how to check disk space in Linux.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations