Operating System - HP-UX
1833210 Members
2689 Online
110051 Solutions
New Discussion

How to find the date on which pvcreate command ran

 
bharani123
Occasional Advisor

How to find the date on which pvcreate command ran

Hi All,

Is there is any way to check when the disk was pvcreated and added to the Volume group
13 REPLIES 13
Prashanth Waugh
Esteemed Contributor

Re: How to find the date on which pvcreate command ran

Hi,

try to find it in /var/adm/syslog/syslog.log


Reagrds
Atul
For success, attitude is equally as important as ability
Deepak Kr
Respected Contributor

Re: How to find the date on which pvcreate command ran

Also

run following

ls -lu /usr/sbin/pvcreate /sbin/pvcreate

regds...DK
"There is always some scope for improvement"
Prashanth Waugh
Esteemed Contributor

Re: How to find the date on which pvcreate command ran

Hi,

You will not get the date when the pvcreated in syslog but on which date u have added the disk to vg that information you will get.search vgextend in syslog.log.


Reagards
Atul
For success, attitude is equally as important as ability
Prashanth Waugh
Esteemed Contributor

Re: How to find the date on which pvcreate command ran

Hi,

You will get the idea from /etc/lvmtab bcoz when you will ran the pvcreate and entend the VG then /lvmtab will update.
Regards
Atul
For success, attitude is equally as important as ability
Vihang.
Trusted Contributor

Re: How to find the date on which pvcreate command ran

Hi,

Whenever you make any changes to a volume group like extending or reducing, a file gets created under /etc/lvmconf. The file will be vgname.conf. So supposing you extended vg02, /etc/lvmconf will have a file called vg02.conf created after you extend the VG. Also, the older file which was created during the previous extension or creation of the VG will be renamed vg02.conf.old. Comparing vg02.conf against v02.conf.old will tell you when a disk was added to VG02. You can use "strings" to read both these files.

Regards,
Vihang.
When everything else fails, read the instructions !!!
James R. Ferguson
Acclaimed Contributor

Re: How to find the date on which pvcreate command ran

Hi:

# xd -An -j8200 -N16 -tu /dev/dsk/cXtYdZ|perl -lane 'print scalar localtime $F[1];exit'

...will return the 'pvcreate' timestamp.

Simply specify the correct '/dev/dsk/cXtYdZ' in the above.

Regards!

...JRF...
SKR_1
Trusted Contributor

Re: How to find the date on which pvcreate command ran

Run below command, you will found the date and time when you have added the disks to Volume group.

grep vgextend /var/adm/syslog/syslog.log

Thanks

SKR
Torsten.
Acclaimed Contributor

Re: How to find the date on which pvcreate command ran

I give you an example when my disk was pvcreated:

# echo "0d8200?UY" | adb /dev/dsk/c0t6d0
2008: 2014063___ 2006 Mar 14 10:52:40


You can see it - it was
2006 Mar 14 10:52:40



BTW:
JRF's command will return the timestamp in seconds since 01/01/1970 in the third position.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
James R. Ferguson
Acclaimed Contributor

Re: How to find the date on which pvcreate command ran

Hi (again):

> Torsten: JRF's command will return the timestamp in seconds since 01/01/1970 in the third position.

No, you are incorrect. My Perl snippet will return a date based on the Unix epoch (01/01/1970) but the format will be:

# xd -An -j8200 -N16 -tu /dev/dsk/c2t6d0|perl -lane 'print scalar localtime $F[1];exit'
Mon Mar 3 13:48:12 2008

Regards!

...JRF...
Torsten.
Acclaimed Contributor

Re: How to find the date on which pvcreate command ran

Sorry, I meant only the first part of the command before the pipe - but I forgot to say this clearly.

;-)

My intention was to highlight the difference between the commands (without the perl extension), because the pure result looks like this:

# xd -j8200 -N16 -tu /dev/rdsk/c0t6d0
0000000 2014063___ 1142329960 2014063___ 1142329961
0000010

The first timestamp is the pvcreation time, the second the vgcreation time.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
James R. Ferguson
Acclaimed Contributor

Re: How to find the date on which pvcreate command ran

Hi (again):

> Torsten: My intention was to highlight the difference between the commands (without the perl extension)...

No problem, but note too that I used a different set of switches with 'xd'. Comparing the two on one server of mine:

# xd -An -j8200 -N16 -tu /dev/dsk/c2t6d0
1644472381 1204570092 1644472381 1204570092

# xd -j8200 -N16 -tu /dev/rdsk/c2t6d0
0000000 1644472381 1204570092 1644472381 1204570092
0000010

Hence, for me, the decimal epoch seconds for the PVID is the second (zero-relative) field, or a value of 1204570092.

Thus:

# perl -le 'print scalar localtime(1204570092)'
Mon Mar 3 13:48:12 2008

# echo "0d1204570092=Y"|adb
2008 Mar 3 13:48:12


...so, all is good :-)

Regards!

...JRF...
Vihang.
Trusted Contributor

Re: How to find the date on which pvcreate command ran

Deepak Kr
Respected Contributor

Re: How to find the date on which pvcreate command ran

James

You perl gem..

hehe
"There is always some scope for improvement"