Linux ENOTBLK (errno 15) — Block Device Required
ENOTBLK (errno 15) means the operation requires a block device but the specified file is not one. This error commonly occurs when trying to mount a regular file or directory as a filesystem. It is distinct from ENXIO (errno 6) because ENOTBLK specifically indicates the file type is wrong, not that the device does not exist.
Common Causes
- Attempting to
mounta regular file instead of a block device - Using the wrong device path in
/etc/fstab - Trying to access a device file that points to a non-block device
- Incorrect device node created by
mknod
How to Fix ENOTBLK
1. Verify the Device Type
Check if the file is actually a block device:
ls -la /dev/sd*
file /dev/sda
2. Create a Loop Device for Files
When mounting a disk image file, use a loop device:
sudo losetup -fP /path/to/disk.img
sudo mount /dev/loop0 /mnt/point
3. Check Mount Command Arguments
Ensure you are mounting a valid block device:
lsblk
sudo mount /dev/sda1 /mnt/point
4. Recreate Device Nodes
If the device node is missing or incorrect:
sudo mknod /dev/sdb b 8 16
sudo chmod 660 /dev/sdb
Verification
After fixing the issue, confirm the mount succeeds:
mount | grep /mnt/point
Related Error Codes
- ENXIO (errno 6) — No such device or address
- ENODEV (errno 19) — No such device
- ENOTDIR (errno 20) — Not a directory
Comments