如何查看Linux分区
时间:2019-11-20 08:53:22 来源:igfitidea点击:
在Linux,如何查看磁盘的分区表?
fdisk命令可用于查看指定设备的分区表列表。
$ sudo fdisk -l
输出示例
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x00009758 Device Boot Start End Blocks Id System /dev/sda1 * 2048 2099199 1048576 83 Linux /dev/sda2 2099200 41943039 19921920 8e Linux LVM Disk /dev/mapper/centos-root: 18.2 GB, 18249416704 bytes, 35643392 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
如果命令没有指定设备名,则使用/proc/partitions中的设备。
我们可以查看指定磁盘的分区表,比如:
$ sudo fdisk -l /dev/sda
还可以通过执行以下命令来查看分区列表:
$ cat /proc/partitions
输出示例:
major minor #blocks name 2 0 4 fd0 8 0 20971520 sda 8 1 1048576 sda1 8 2 19921920 sda2 11 0 4669440 sr0 253 0 17821696 dm-0 253 1 2097152 dm-1