1825805 Members
2021 Online
109687 Solutions
New Discussion

Raw Disk

 
Dirk Moolman
Frequent Advisor

Raw Disk

Hi, being new to HP-UX, I am trying to understand how the raw disk was created on our client's server.

The devices being used are /dev/vg??.

Any information would be appreciated.

Thank you
Dirk
11 REPLIES 11
Pete Randall
Outstanding Contributor

Re: Raw Disk

All disk devices have two methods of access: raw and "cooked". When the device files are created, there are two versions created: /dev/vg??/lvol?? and /dev/vg??/rlvol?? (or /dev/dsk/c?t?d? and /dev/rdsk/c?t?d? for non-lvm). The only difference between the two is that the raw (rlvol??) device file bypasses the system's buffer cache. This is typically used for databases, where the DB itself does the buffering.


Pete

Pete
Dirk Moolman
Frequent Advisor

Re: Raw Disk

Thank you - another question if you don't mind: How are these raw volumes created ?

On Solaris I use the format utility.
What is the utility on HP-UX for creating the /dev/vg??/lvol? volumes ?
The client is on HP-UX 10.20
Pete Randall
Outstanding Contributor

Re: Raw Disk

pvcreate - create physical volume for use in LVM volume group

vgcreate - create LVM volume group

lvcreate - create logical volume in LVM volume group


Pete

Pete
Gurumanickam
Frequent Advisor

Re: Raw Disk

hi,

mediainit - if you want to low level format your hard disk

pvcreate - Create a physical volume

create a directory and group file
mkdir /dev/vg?

mknod /dev/vg?/group c 64 0x??00

vgcreate - Create a volume group

lvcreate - Create a logical volume

Then if you want to create a filesystem you can use newfs command

for more info see the man pages of above commands.

Be an expert
Calandrello
Trusted Contributor

Re: Raw Disk

Lvcreate is enough to effect the creation of lvol with the command, e to change the permission for the application that anger to use raw device.
Frank de Vries
Respected Contributor

Re: Raw Disk

Hi Dirk

The "raw" files are created with you use de "lvcreate" command.

Umount /dev/vgxx/lvyyy and use /dev/vgxx/rlvyyy

Create new controlfiles for use this devices.

Verify permission for raw devices.

So indeed raw files don't get mounted.
(So called cooked files do.)

You create the raw filesystem with
mknod , just like logical volume.

Sample:

crw-r----- 1 oracle dba 64 0x76000e Oct 18 01:01 /dev/vgxx/lvyyy

You need to specify in your db this path
as the location of your log.

The advantage is that even when you
inadvertently delete the raw device,
i.e. the logical volume, you will not
lose your data.

The device is just a pointer to a location on the disk. So you can just re-make your device with mknod. You need however need to document the major and minor number to be sure what is what.

Look before you leap
Dirk Moolman
Frequent Advisor

Re: Raw Disk

In /dev I can see a list of volume groups (vg01, vg02, etc.) Some of them are empty (contain no logical volumes).

If I use the lvcreate command, will it grab any available space in the volume group I specify, or do I need to be more specific ?

Also, which command will display the current vg/lv layout as it is ?
Dirk Moolman
Frequent Advisor

Re: Raw Disk

I found the vgdisplay command (in /usr/sbin), and will try to get some information out of the system using this command.
Ralph Grothe
Honored Contributor

Re: Raw Disk

vgdisplay on those volume groups (VGs) will show you how many unused physical extents (PEs) are available.
These PEs multiplied by the PE size (which was specified or the default taken on VG creation) will theoretically yield how many MBs you can use for new logical volumes (LVs).
Theoretically, because it depends on other parameters such as allocation policy etc.

e.g.

# vgdisplay vgSPI|grep -E 'Free PE|PE Size'
PE Size (Mbytes) 16
Free PE 903

# echo $((16*903))
14448

An LV is build up from logical extents (LEs)
which is an abstraction layer (similar to plexes) where at least sizewise 1 LE = 1 PE.
The actual mapping is done behind the scenes by the logical volume manager (LVM)

You can now simply precede to create a new LW

e.g.

# lvcreate -l 4 -n my_1st_lv vgSPI
Logical volume "/dev/vgSPI/my_1st_lv" has been successfully created with
character device "/dev/vgSPI/rmy_1st_lv".
Logical volume "/dev/vgSPI/my_1st_lv" has been successfully extended.
Volume Group configuration for /dev/vgSPI has been saved in /etc/lvmconf/vgSPI.conf

# lvdisplay /dev/vgSPI/my_1st_lv
--- Logical volumes ---
LV Name /dev/vgSPI/my_1st_lv
VG Name /dev/vgSPI
LV Permission read/write
LV Status available/syncd
Mirror copies 0
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 64
Current LE 4
Allocated PE 4
Stripes 0
Stripe Size (Kbytes) 0
Bad block on
Allocation strict
IO Timeout (Seconds) default


You can use this LV consisting of 4 LEs which span 64 MB either directly in raw mode (what many databases do), or create a filesystem on it and mount it.
Note that you can also specify the length of the LV in MB by using -L (be careful not to mix up with -l)

Destruction is as simple as
(note data on it will be inaccessible afterwards, raw or cooked)
The -f avoids the wary confirmatory question (good for scripts)

# vgdisplay vgSPI|grep Free\ PE
Free PE 899

# lvremove -f /dev/vgSPI/my_1st_lv
Current path "/dev/dsk/c15t0d0" is an alternate link, skip.
Current path "/dev/dsk/c15t0d1" is an alternate link, skip.
Logical volume "/dev/vgSPI/my_1st_lv" has been successfully removed.
Volume Group configuration for /dev/vgSPI has been saved in /etc/lvmconf/vgSPI.conf

# vgdisplay vgSPI|grep Free\ PE
Free PE 903

# lvcreate -L 60 -n my_1st_lv vgSPI
Warning: rounding up logical volume size to extent boundary at size "64" MB.
Logical volume "/dev/vgSPI/my_1st_lv" has been successfully created with
character device "/dev/vgSPI/rmy_1st_lv".
Logical volume "/dev/vgSPI/my_1st_lv" has been successfully extended.
Volume Group configuration for /dev/vgSPI has been saved in /etc/lvmconf/vgSPI.conf

# vgdisplay vgSPI|grep Free\ PE
Free PE 899

Note, how LVM rounded up from 60 MB to 64 MB,
which is evenly divisable by this PE size of 16 MB.

Now create a VxFS on it.

# newfs -F vxfs /dev/vgSPI/rmy_1st_lv
version 4 layout
65536 sectors, 65536 blocks of size 1024, log size 1024 blocks
unlimited inodes, largefiles not supported
65536 data blocks, 64432 free data blocks
2 allocation units of 32768 blocks, 32768 data blocks

# fstyp -v /dev/vgSPI/rmy_1st_lv
vxfs
version: 4
f_bsize: 8192
f_frsize: 1024
f_blocks: 65536
f_bfree: 64419
f_bavail: 60393
f_files: 16136
f_ffree: 16104
f_favail: 16104
f_fsid: 1073872914
f_basetype: vxfs
f_namemax: 254
f_magic: a501fcf5
f_featurebits: 0
f_flag: 0
f_fsindex: 7
f_size: 65536


and mount it somewhere

# mkdir -p /mnt/tmp1 && mount /dev/vgSPI/my_1st_lv /mnt/tmp1

# bdf /mnt/tmp1
Filesystem kbytes used avail %used Mounted on
/dev/vgSPI/my_1st_lv
65536 1117 60400 2% /mnt/tmp1


Madness, thy name is system administration
Tim D Fulford
Honored Contributor

Re: Raw Disk

Hi

I dont wish to be rude here, but you really should be careful when fiddling with logical volumes. LVM itself is not greatly different to other volume managers (I forget the Sun one) VxVM etc. Try doing "man lvm" for some of the basics of lvm. You just dont want to dig youself into a hole, and have to justify an outage to correct it (I've been there)

OK. to create a LV (logica volume) you use lvcreate. Whilst it is possible to do the below..
lvcreate [-n ] -L

You can also use various options to stripe or mirror the LV over PV (physical volumes). This should be some form of administrators policy, so if you dont know, you might need to ask. Herein lies the problem. If the admin policy is to use mirrored extent stripe, and you craete unmirrored unstriped LV, then you can be faced with an outage to correct this... I'm just saying be careful...

Regards

Tim
-
Frank de Vries
Respected Contributor

Re: Raw Disk

As you assign points, please keep in mind the scale that applies:

N/A: The answer was simply a point of clarification to my original question

1-3: The answer didn't really help answer my question but thanks for your assistance!

4-7: The answer helped with a portion of my question, but I still need some additional help.

8-10: The answer has solved my problem completely! Now I'm a happy camper!

If you have questions about the Points System, please look for more information in the Support Forums FAQs.

Look before you leap