--- title: "Mount a volume on Linux" description: "Format and mount an attached Block Storage volume on a Linux node, and keep the mount across a reboot." content_type: "how-to" product: "volumes" platform: "MyAccount" url: "/myaccount/volumes/how-to/mount-a-volume-on-linux/" topic: ["create"] relationships: {"requires":["/myaccount/volumes/how-to/attach-a-volume/"]} --- # Mount a volume on Linux After you attach a volume to a Linux node, it appears as a block device. To use it, you format it with a file system (if it is empty) and mount it at a directory. Once mounted, everything you write to that directory is stored on the volume. The examples assume the volume shows up as `/dev/vdb` and your node's own root disk is `/dev/vda1`; your device names can differ, so check them first. ## Before you begin - A volume attached to the node. See [Attach a volume](/myaccount/volumes/how-to/attach-a-volume/). - Access to the node over SSH. ## Find the volume's device name On the node, list the block devices: ```bash lsblk ``` The attached volume is the unmounted device, for example `/dev/vdb`. Check its device name before doing anything else. ## Check whether the volume needs formatting An empty volume has no file system and must be formatted; a volume created from a snapshot often already has one. Check which you have: ```bash sudo file -s /dev/vdb ``` If it prints `data`, the volume has no file system. If it prints a type such as `XFS` or `ext4`, it is already formatted, skip the formatting step and do not format it again, or you erase its data. ## Format the volume An empty volume needs a file system. This example uses XFS; `ext4` also works if you prefer it. ```bash sudo mkfs -t xfs /dev/vdb ``` Formatting erases all data on the volume. Run it only on an empty volume, never on one created from a snapshot or one that already holds data. If the command is not found, install the XFS utilities: `sudo yum install -y xfsprogs`, or on Ubuntu `sudo apt install -y xfsprogs`. ## Mount the volume 1. Create a directory to mount it at, for example `/data`: ```bash sudo mkdir /data ``` 2. Mount the volume to that directory: ```bash sudo mount /dev/vdb /data ``` 3. Confirm the mount: ```bash df -h ``` You can read and write to `/data` now, and the volume stores it. ## Keep the mount across a reboot To keep the mount across reboots, add it to `/etc/fstab` by the device's UUID. 1. Find the UUID: ```bash sudo blkid /dev/vdb ``` The output shows a line like `UUID="e7c5b2f2-..." TYPE="xfs"`. Copy the UUID value. 2. Edit `/etc/fstab`: ```bash sudo nano /etc/fstab ``` 3. Add a line at the end, using your own UUID and mount point: ```text UUID=e7c5b2f2-8b2a-4e13-b9a9-bb3f122a91f1 /data xfs defaults,nofail 0 2 ``` 4. Apply the configuration and check for errors: ```bash sudo mount -a ``` If `mount -a` prints no errors, the setup is correct. Reboot the node and run `df -h` again to confirm `/data` mounts automatically. The volume is mounted and stays mounted across reboots. When you later detach it, unmount it and remove its `/etc/fstab` line first; see [Detach a volume](/myaccount/volumes/how-to/detach-a-volume/). If it will not mount, see [Troubleshooting Volumes](/myaccount/volumes/troubleshooting/volumes/).