My Block Storage device is not listed on /dev/disk/by-id
Hi there,
I went through the steps to create a block storage device on my Linode. When I try run the mkfs.ext4 /dev/disk/by-id/scsi-NewStorage
command, it can't find the device. This is a custom linux image and there's no /dev/disk directory at all. How do I make this work?
2 Replies
Hi there,
On our officially-supported Linux images, you'll find that the /dev/disk/by-id directory contains links to the actual device:
bellis@node:/dev/disk/by-id$ ls -lh
total 0
lrwxrwxrwx 1 root root 9 Jan 14 14:26 ata-QEMU_HARDDISK_QM00001 ->
../../sda
lrwxrwxrwx 1 root root 9 Jan 14 14:26 ata-QEMU_HARDDISK_QM00002 ->
../../sdb
lrwxrwxrwx 1 root root 9 Jan 14 14:26 scsi-newStorage ->
../../sdc
bellis@node:/dev/disk/by-id$
If you are using a linux distribution that does not use this structure, you can look at your configuration profile in Linode Manager or Cloud Manager and see what device your block storage device is assigned to.
You can then create and mount a filesystem on that device as such:
Create the filesystem:
mkfs.ext4 /dev/sdX
Create the mountpoint:
mkdir /mnt/newStorage
Mount the disk:
mount /dev/sdX /mnt/newStorage
If you want the volume to automatically mount every time your Linode boots, you'll want to add a line like the following to your /etc/fstab file:
/dev/sdX /mnt/newStorage ext4 defaults,noatime 0 2
.. substituting your block device for sdX in the above commands.
Since hot-pluggability is not guaranteed to work in custom images, you may need to reboot your Linode for your disk to be available at /dev/sdX.
If you want the /dev/disk/by-id
paths to work, udev needs to be running. As a bonus, you'll have fully working hotplugging of Block Storage devices (most of the hotplugging work is done by the kernel, but I don't remember if it'll create the block device file in /dev on its own, or if it expects userspace to do that).