Operating System - HP-UX
1825759 Members
2216 Online
109687 Solutions
New Discussion

Re: explanations wanted: raw devices, mapping, size

 
SOLVED
Go to solution
Doug_3
Frequent Advisor

explanations wanted: raw devices, mapping, size

OK, once again I'll ask one of those "there are no stupid questions" which we all know is false...but speaking as a dba who is also acting sysadmin...

I have created several raw dev for our database, but from a high level and technical perspective, what is a raw device, how does unix treat it, how is it different than normal disk/file space the OS manages?

When I execute a bdf or du, the raw devices are not listed. How do I know it's true size except to use the database tools or to subtract the disk size from the total used from SAM?

Last, when I need to increase the database spaces that map to a specific raw device, and the db engine wants contigious space, how do I know it is contigious?

tia
p.s. I've posted a couple times and the responses have been great, I regret to say that every other time I have been unable to assign points. Sorry 'bout that.
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor

Re: explanations wanted: raw devices, mapping, size

Doug:

The term "raw" logical volume refers to a logical volume that is NOT used to store file system or swap space data. Typically, it is used by a database manager, to store its data and overhead structures.

Device files, represent the PHYSICAL device
(the actual disk drive space, in the case of a logical volume). There are two types of device files: block or character (also known as raw). The block file, in the case of logical volume device files, is used to mount and unmount physical volumes, while the character (raw) device file is used to
create physical volumes.

Using the /dev/dsk/cXtXdX type device files will require that the entire disk be used as a filesystem or as raw data. if pvcreate(1M) is mistakenly used on the disk to prepare for LVM usage, then the filesystem or data that was present on the disk will be corrupted. The largest filesystem or raw database space that can be created is limited to the size of the physical disk.

Choosing to use the /dev/vgXX/lvolX or /dev/vgXX/rlvolX style device files assumes that the LVM structure is in place for this disk partition that is being allocated. This format does not require one to use the entire physical disk nor does it limit one to using just one disk per filesystem or raw data space.

There is no easy way to convert a ?Whole Disk? into LVM, or vice-versa, without wiping
it clean and starting anew.

...JRF...
Lawrence Mahan
Frequent Advisor

Re: explanations wanted: raw devices, mapping, size

I teach inhouse class on the Informix database. The first question that is always askes is 'What is RAW space'. Basically RAW space is a logical volume that is not being used by UNIX. It's like the perverbial they. You know they are there but you can not see them.

By not assigning the LV to a file system or swap space you have RAW space. As such you can not see the space with any UNIX tools except lvdisplay. To find the size of the RAW space use lvdisplay and multiply the LV Size by 1024. This will give you the number of Kbytes.

For a LV to be contigious you will need to lvcreate or lvmodify the LV with these switches.

-s y -C y

This will force the LV and its' mirrors to be contigious. This way if you need to inlarge the space the space will only inlarge if contigious space is available.

Special Note: Being that the operation system is controling the mapping of a LV you can usually have a noncontigious LV that looks contigious to the database. This way I have been able to stripe a RAW space over several physical volumes and use it as a single dbspace for the database. I know this is true for Informix. I do not know about Oracle or other databases.
John Palmer
Honored Contributor
Solution

Re: explanations wanted: raw devices, mapping, size

Hi Doug,

It's probably easier these days to forget about whole disks and just consider LVM.

Each 'raw device' that you have created is a 'volume' in LVM terms and as such is purely an area of disk space. A filesystem is simply a raw device that has been formatted in a special way.

UNIX treats it as a contiguous area of disk - it doesn't have to be contiguous on 'real disks' but LVM makes it appear so to whatever application is accessing it.

The management of it is up to the application that is using it, typically a database engine such as Oracle. Instead of a single file within a filesystem, the application treats the 'raw device file' as a single file.

One important thing to note is that UNIX does pretty much all (there are special vxfs mount options) filesystem I/O via its in-memory buffer cache. Raw disk devices do not use the buffer cache so raw I/O does not carry that OS overhead.

The only way to determine the size of the raw device is to use LVM commands such as vgdisplay and lvdisplay. As you are aware, bdf and du only display mounted filesystems.
It may be worth considering adopting a naming convention for raw volumes such that relevant information can be easily 'grepped' from a vgdisplay listing. Another idea is to include raw volume names as comments in /etc/fstab as a reminder.

You can extend a logical volume by using the lvextend command. LVM volumes will always be contiguous as far as an application is concerned. The procdure for Oracle would be:-
- lvextend the volume as appropriate
- alter database datafile '...' resize xxxM;

Hope this helps,
John