Linux下,如何查看磁盘是否包含数据

可以使用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  |...............)|

00000010   00000000 00000000 00000000 00000000  |................|

00000020   4F52434C 4449534B 00000000 00000000  |ORCLDISK........|

00000030   00000000 00000000 00000000 00000000  |................|

00000040   0B200000 00000103 4F43525F 30303030  |. ......OCR_0000|

00000050   00000000 00000000 00000000 00000000  |................|

00000060   00000000 00000000 4F435200 00000000  |........OCR.....|

00000070   00000000 00000000 00000000 00000000  |................|

00000080   00000000 00000000 4F43525F 30303030  |........OCR_0000|

00000090   00000000 00000000 00000000 00000000  |................|

000000A0   00000000 00000000 00000000 00000000  |................|

000000B0   00000000 00000000 00000000 00000000  |................|

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

00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

*

00000400

很明显,磁盘/dev/sdb1已经被使用了,而/dev/sdb6还没有被使用。其中,-n参数表示只格式前n个长度的字符,而-C参数表示每个字节显示为16进制和相应的ASCII字符。

上一篇:在Centos下面FTP映射方案


下一篇:Cocos2d-x for Windows Phone 用法总结