To mount an EBS volume on Linux, attach it to the instance in the same Availability Zone, create a file system on it the first time, mount it at a directory and add an entry to /etc/fstab so it mounts on every boot. This is the standard way to "mount ebs volume linux" for a new data disk.
Warning: formatting a volume erases it. Only run mkfs on a new, empty volume, never on one that holds data you want to keep.
The volume and the instance must be in the same Availability Zone. In the console choose Volumes, select the volume, Actions, Attach volume, pick the instance and a device name such as /dev/sdf. With the CLI:
On Nitro-based instances the device appears inside Linux as an NVMe device (for example /dev/nvme1n1), not as /dev/sdf, and the number can change between boots. That is why you should mount by UUID, as shown below.
Connect to the instance and list block devices:
The 100 GiB disk nvme1n1 has no partitions and no mount point, so it is the new volume. Check whether it already has a file system:
If the output is just data, there is no file system. If it shows something like SGI XFS filesystem or ext4 filesystem data, the volume already has data, so skip the next step.
For a new volume, XFS is the default on Amazon Linux, and ext4 is common on Ubuntu:
Using the whole disk without a partition table is fine for a single data volume and makes later resizing simpler.
Set ownership so your application user can write:
A manual mount disappears after a reboot. Add the volume to /etc/fstab using its UUID, which is stable even if the device name changes:
The nofail option lets the instance boot even if the volume is missing, which prevents a server that you cannot log in to. Running sudo mount -a after editing fstab validates the line; a typo found now is far better than one found during the next reboot.
sudo umount /data.fstab line.aws ec2 detach-volume --volume-id vol-0abc123def4567890.Detaching a mounted volume risks data corruption, because buffered writes may not have reached the disk.
After editing fstab, reboot once and confirm the mount returns. Run findmnt /data to see the source and options, and lsblk -f to list file system types and UUIDs for every disk. If the volume is missing, read journalctl -b for mount errors. For a volume you plan to reuse on several instances through snapshots, give the file system a label (xfs_admin -L data /dev/nvme1n1 for XFS) so scripts can refer to LABEL=data.
| Symptom | Likely cause |
|---|---|
Volume does not show in lsblk | Attach not finished, or wrong instance or zone |
mount: wrong fs type | No file system yet, or wrong type given |
Permission denied writing to /data | Directory owned by root; use chown |
| Instance fails to boot after reboot | Bad fstab line without nofail |
| Volume mounted but old data missing | You formatted a volume that already had data |
Nitro instances present EBS volumes as NVMe devices, so /dev/sdf becomes something like /dev/nvme1n1. Use UUIDs or file system labels instead of device names.
Not for a single data volume. You can format the whole device. Partition only if you need several file systems on one volume or a boot layout.
Skip mkfs and just mount it. Check with file -s first, and if you restored it from a snapshot, the file system is already there.
Yes, but a volume restored from a snapshot loads blocks lazily, so first reads can be slower until blocks are read once.
Attach the volume in the same zone, find it with lsblk, create a file system only if it is empty, mount it, and persist the mount in /etc/fstab by UUID with nofail. Test with mount -a, unmount cleanly before detaching, and never run mkfs on a volume that holds data.