Operating System - HP-UX
1830342 Members
2599 Online
110001 Solutions
New Discussion

How to read raw disk information (dd if=/dev/rdsk/c?t?d? |xd -c"

 
VINY
Occasional Advisor

How to read raw disk information (dd if=/dev/rdsk/c?t?d? |xd -c"

I would like to find out verify a disk on HP-UX. Reasons for this is to
make sure that if I create a new mount point or allocate an existing,
that I don't delete anything that is already in use.

The way I verify today is the following:

1. cname=/dev/dsk/c?t?d?; pvcreate $cname
*** if there is any data on the disk (lvm header, oracle raw info),
then we will verify that the device is not allocated on any other
mounts or raw mounts.
Verify by the following:
a. check lvmtab (strings /etc/lvmtab)
b. check all vg's (ls /dev/*/group|sed 's/\/group//g'|xargs -n1
vgdisplay -v |grep "PV Name"
c. check via xpinfo (xpinfo -i|grep $cname)
d. check via inq (inq |grep $cname)
e. check pv (pvdisplay $cname)
f. check dd information: For LVM use (dd if =/dev/rdsk/c?t?d? |xd
-c)
For Oracle use (dd if
/dev/rdsk/c?t?d? bs=8k count=1|xd -c)

Is there any way we can view actual data on the device if pvcreate
comes back with valid information besides the dd command?

Please give me your thoughts on this!

Alvin Cly aka viny
alvin....@usfood.com
Projects Smawjects
5 REPLIES 5
baiju_3
Esteemed Contributor

Re: How to read raw disk information (dd if=/dev/rdsk/c?t?d? |xd -c"

Hi Alvin,

lvm.11 is a utility which you can use to get information from a disk .


Usage lvm.11 [-ilpbBvVsmPSTfa?] -d
Where
-i print information of LVM disc structure
-l print lvmrec
-p print PVRA
-b print BBDIR
-B print BDRA
-v print VGRA
-V print VGDA
-s print VGSA
-m print MCR
-P print only Primary areas
-S print only Secondary areas
-T print both Primary and Secondary areas
-f allow usage on non-raw device
-c print cluster lock areas - If flagged in use
-C print cluster lock areas - Regardless of flag
-a print ALL above areas
-? print this usage screen
version 1.30
Good things Just Got better (Plz,not stolen from advertisement -:) )
A. Clay Stephenson
Acclaimed Contributor

Re: How to read raw disk information (dd if=/dev/rdsk/c?t?d? |xd -c"

There is really no ironclad way to do this because if you are running truly raw disks (not under LVM or VxVM --- and this is perfectly legal) then any data on the disk would only have meaning to the application actually using it. Examining such a disk with dd only works in that case if you know what you are looking at. You also left out swap in your list above --- if swap were done outside LVM -- again, perfectly legal.

My convention is document, document, document. Whenever I install a new disk or create a new LUN, I run a utility that writes the hex pattern 0xABCD on the first 10MB of the device even if I am immediately plan to use the disk in LVM. That way, if I see this known pattern, I know the disk is unused --- or at least the first 10MB is unused.
If it ain't broke, I can fix that.
Edgar_8
Regular Advisor

Re: How to read raw disk information (dd if=/dev/rdsk/c?t?d? |xd -c"

Hi Alvin,

Gotta agree with AC regarding documenting system configuration. We had a case last year where an alternate path to a disk was not documented (ie. via the lvmpvg or lvmtab) and we went ahead and extended a vg using the alternate path.
Needless to say we wiped out all the original data that was on the alternate path pv's primary pv! Below is what we have proposed to do to prevent such occurrences:

1. update the lvmpvg file and lvmtab by extending vg's using the alternate paths
2. running vgdisplay against vg's
3. running pvdisplay against all pv's
4. running vgscan using the -p option
5. and a last option, which I doubt will be supported by HP if something goes wrong is run "adb - $devicefile" to determine if there are any vg id or pv id on pv

HTH
VINY
Occasional Advisor

Re: How to read raw disk information (dd if=/dev/rdsk/c?t?d? |xd -c"

Thanks for your input, much appreciated! Documentation is still under way. Now, I belive the person who responded to my question was talking about a lvm.11 or lvm.ll command. Where can I obtain that? I would like to see how that works. Thanks again for your answers. Please post more answers if you have them.

thank you.
Projects Smawjects
Emil Velez
Honored Contributor

Re: How to read raw disk information (dd if=/dev/rdsk/c?t?d? |xd -c"


Agree with previous posters.

One thing that was not mentioned was

If you want to see if there is a filesystem on the logical volume you can use the

fstyp -v