如果卸下驱动器,则可以执行以下几项操作。
您可以使用类似fdisk -l
或的命令sfdisk -l
来列出分区。如果分区设置正确,则仅分区类型可能会为您提供一些有用的信息。
# sfdisk -l
Disk /dev/sda: 4177 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End #cyls #blocks Id System
/dev/sda1 * 0+ 30 31- 248976 83 Linux
/dev/sda2 31 4176 4146 33302745 8e Linux LVM
/dev/sda3 0 - 0 0 0 Empty
/dev/sda4 0 - 0 0 0 Empty
如果您的系统上有此文件,则可以vol_id
对分区使用命令以返回一些有用的详细信息(Debian上udev软件包的一部分)。这通常会告诉您实际上正在使用什么文件系统。
# vol_id /dev/sda1
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=32c44d53-9025-4d10-8f36-75c166547bd5
ID_FS_UUID_ENC=32c44d53-9025-4d10-8f36-75c166547bd5
ID_FS_LABEL=
ID_FS_LABEL_ENC=
ID_FS_LABEL_SAFE=
该命令lshw -class disk
将为您提供有关驱动器类型的一些详细信息。如果您对驱动器的实际序列号感到好奇,则可能需要使用它。
# lshw -class disk
*-disk
description: ATA Disk
product: VBOX HARDDISK
physical id: 0.0.0
bus info: scsi@0:0.0.0
logical name: /dev/sda
version: 1.0
serial: VB169e93fb-d1e0fd97
size: 32GiB (34GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 signature=000d39f8
如果确定有特定的文件系统(例如ext2 / 3),则可以使用特定于文件系统的tune2fs工具检查更多详细信息。
# tune2fs -l /dev/sda1
tune2fs 1.41.3 (12-Oct-2008)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: 8cbdf102-05c7-4ae4-96ea-681cf9b11914
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: filetype sparse_super
Default mount options: (none)
Filesystem state: not clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 124496
Block count: 248976
Reserved block count: 12448
Free blocks: 212961
Free inodes: 124467
First block: 1
Block size: 1024
Fragment size: 1024
Blocks per group: 8192
Fragments per group: 8192
Inodes per group: 4016
Inode blocks per group: 502
Last mount time: Thu Oct 7 15:34:42 2010
Last write time: Thu Oct 7 15:34:42 2010
Mount count: 4
Maximum mount count: 30
Last checked: Wed Sep 15 09:29:03 2010
Check interval: 0 (<none>)
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 128
另一个有用的工具是lsblk。
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
└─sda1 8:1 0 30G 0 part
├─vg1-root (dm-0) 254:0 0 23.3G 0 lvm /
└─vg1-swap (dm-1) 254:1 0 1.9G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
如果您已分开安装,则可以运行如下命令
parted /dev/sda print all
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 34.4GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 32.3kB 255MB 255MB primary ext2 boot
2 255MB 34.4GB 34.1GB primary lvm
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/vg1root: 32.6GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number Start End Size File system Flags
1 0.00B 32.6GB 32.6GB ext3
无论如何,我建议您看看udev或parted源。