Difference between /dev/hdisk and /dev/rhdisk

Hi,

How can i check that i am using RAW devices for storage in my AIX machine...

Also after adding a LUN from storage to a aix host, when i check /dev in the host, i can see both rhdisk and hdisk with same number

eg:

dcback1(root):/dev>ls -lrt | grep disk12
crw-------    1 root     system       23,  4 Feb 28 13:11 rhdisk12
brw-------    1 root     system       23,  4 Feb 28 13:11 hdisk12
dcback1(root):/dev>

but in lsdev, i can see only hdisk...

What is the difference between /dev/rhdisk and /dev/hdisk...

Regards,
jibu

The question can easily be answered with a 5-second google search for "AIX rhdisk hdisk". I suggest you read the first hit coming up on this search:

IBMs documentation.

Even without searching for anything your directory listing shows one to be a character-device and the other to be a block device.

For the future i suggest using google first and us second.

I hope this helps.

bakunin

Hi bakunin,

I had gone through google prior to posting and couldnot identify whether my filesytem is made of the rawdisks or non-raw disks....

I could understand that 'c' indicated character and 'b' indicated block access. But still i couldnot decide on whether my machine uses raw devices or not...

Regards,
Jibu

It usually helps if you ask what you really want to know, instead of something vaguely related to that. We are not adverse to explaining things, but commonly get angry when we get the feeling that we are abused to cover a lack of energy.

Your filesystem is made of volumes, neither raw nor other disks. That is the point of having a logical volume manager.

There is a driver for each certain (type of) disk: SCSI drives, LUNs, whatever. This driver creates a blockdevice and a character device. If you want to use the device directly, you can do that and, for instance, use a program like "dd" to write to it.

Otherwise you give this device to the LVM, which uses it to create Physical Volumes, PVs. "creating PVs" means it writes all sort of management-information onto it, like the VGDA (volume group descriptor area), etc.. Think of this like taking open (raw) land and build roads, create lots, and so on: the land is still unused, but now the means to use it are there.

Now you create Logical Volumes, LVs, on this now usable space. You can use such an LV like a raw device too (and this is sometimes done, for instance with databases), but it is not the same as the raw devices from before, because now this raw space is under control of the LVM and can be handled by its methods: it can be moved to another PV, increased in size, ...

Finally, you can create a filesystem on such an LV, instead of using the provided space directly. You could also create a swap space, a dump device or something entirely different instead. Depending on what you create a certain driver (for filesystems the filesystem driver) will use the LV to create the entity it is designed to provide.

I hope this clears it up a bit.

bakunin

Basically, for all *NIX systems, filesystems are created and used via block devices, not character devices.

By definition, character devices have a window of 1 char - a driver might buffer that a little bit (so you can unchar(), or back up one byte.

Block devices are, by definition - finite in size (while char devices may be infinite) - and block devices are "seekable". Because they are seekable, an information system, such as a file system can be stored on them.

Note: some device drivers use ioctl() to perform actions similar to seek - hence the confusion. However, the original definition (at least as far back as UNIX v6) was that character devices did not seek.