2

This is a question about Linux storage device names on RHEL5 and RHEL6

Most storage devices are accessible using device names /dev/sda, /dev/sdb, etc. By storage device I mean a device that could be partitioned, formatted and mounted as regular filesystem.

However, HP servers use /dev/cciss/c0d0, /dev/cciss/c0d1, etc. as the device name, probably due to historical reasons.

This means that commands or scripts need a special case to handle /dev/cciss/cxdx as opposed to /dev/sdx

I understand that the cciss module has been replaced by the hpsa module in RHEL6 which removes this inconsistency.

However, this is a more general question - are there any other non-standard storage device names that could trip up a command or script that is only looking for /dev/sdx?

Sam Elstob
  • 365
  • 1
  • 3
  • 7

1 Answers1

3

What you call a "storage device" is more generally referred to as a "block device". If you're writing scripts that interact with block devices, it seems like your best bet is to enumerate things in /sys/class/block and work from there, or use the various entries in /dev/disk (in fact, it looks like the latter may be a better choice under RHEL5). This way you're asking the system for a list of available block devices, rather than having to maintain some table of device names in your code.

Off the top of my head, other block devices you might encounter include:

  • virtio block devices (/dev/vda, etc)
  • Loop device (/dev/loop0)
  • Device mapper devices (/dev/mapper/... and /dev/dm-0)
  • Xen virtual disks (/dev/xvda)
  • Ceph RBD devices (/dev/rbd/...)

Not all block devices can be partitioned, but they can all hold a filesystem.

larsks
  • 43,623
  • 14
  • 121
  • 180
  • 1
    I remember block/char devices and creating device files from my early days of Linux/Unix. Maybe I'm mistaken but it feels like things got more complicated since then (udev, /sys). Just checked and /sys/class/block doesn't exist on RHEL5 - at least not on the system I've just looked at, however /sys/block does exist. I confess I've never really understood the structure of sysfs; I've always got lost in a twisty maze of symlinks... – Sam Elstob Aug 06 '13 at 16:20
  • Yeah, I noticed that the paths changed between the RHEL5 and RHEL6 kernels. Both have `/dev/disk`, though. – larsks Aug 06 '13 at 17:14