真題1、在AIX或Linux下,如何檢視磁盤是否包含資料?
答案:在AIX下,可以使用lquerypv -h來檢視磁盤是否包含資料,或磁盤頭是否被dd過。這在安裝RAC的過程中,是非常實用的一個指令。如果不包括資料的話,那麼如下所示:
[ZFFR4CB2101:root]/]> lquerypv -h /dev/rhdisk10
00000000 00000000 00000000 00000000 00000000 |................|
00000010 00000000 00000000 00000000 00000000 |................|
00000020 00000000 00000000 00000000 00000000 |................|
00000030 00000000 00000000 00000000 00000000 |................|
00000040 00000000 00000000 00000000 00000000 |................|
00000050 00000000 00000000 00000000 00000000 |................|
00000060 00000000 00000000 00000000 00000000 |................|
00000070 00000000 00000000 00000000 00000000 |................|
00000080 00000000 00000000 00000000 00000000 |................|
00000090 00000000 00000000 00000000 00000000 |................|
000000A0 00000000 00000000 00000000 00000000 |................|
000000B0 00000000 00000000 00000000 00000000 |................|
000000C0 00000000 00000000 00000000 00000000 |................|
000000D0 00000000 00000000 00000000 00000000 |................|
000000E0 00000000 00000000 00000000 00000000 |................|
000000F0 00000000 00000000 00000000 00000000 |................|
如果包括資料的話,那麼顯示如下所示:
[ZFFR4CB2101:root]/]> lquerypv -h /dev/rhdisk10
00000000 00820101 00000000 80000000 B6FE0F29 |...............)|
00000020 4F52434C 4449534B 00000000 00000000 |ORCLDISK........|
00000040 0B200000 00000103 4F43525F 30303030 |. ......OCR_0000|
00000060 00000000 00000000 4F435200 00000000 |........OCR.....|
00000080 00000000 00000000 4F43525F 30303030 |........OCR_0000|
000000C0 00000000 00000000 01F80D69 66A0E000 |...........if...|
000000D0 01F80D69 70C48800 02001000 00100000 |...ip...........|
000000E0 0001BC80 0002001C 00000003 00000001 |................|
000000F0 00000002 00000002 00000000 00000000 |................|
在Linux中,可以使用hexdump指令來實作相同的效果,如下所示:
[root@OCPLHR ~]# hexdump -n 1024 -C /dev/sdb1
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000200 4c 41 42 45 4c 4f 4e 45 01 00 00 00 00 00 00 00 |LABELONE........|
00000210 50 ef ff c1 20 00 00 00 4c 56 4d 32 20 30 30 31 |P... ...LVM2 001|
00000220 53 68 78 53 57 33 43 33 48 64 44 48 33 56 65 79 |ShxSW3C3HdDH3Vey|
00000230 44 54 50 78 4a 6e 42 66 46 37 74 5a 4a 78 79 7a |DTPxJnBfF7tZJxyz|
00000240 00 84 a6 54 02 00 00 00 00 00 03 00 00 00 00 00 |...T............|
00000250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000260 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 |................|
00000270 00 f0 02 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000280 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000400
[root@OCPLHR ~]# hexdump -n 1024 -C /dev/sdb6
很明顯,磁盤/dev/sdb1已經被使用了,而/dev/sdb6還沒有被使用。其中,-n參數表示隻格式前n個長度的字元,而-C參數表示每個位元組顯示為16進制和相應的ASCII字元。
<b>&</b><b> </b><b>說明:</b><b></b>
有關lquerypv和hexdump的更多内容可以參考我的BLOG:http://blog.itpub.net/26736162/viewspace-2149976/