linux disk capacity see order information -lsblk, blkid, dumpe2fs

A, lsblk block command information for all available devices listed, but also show the dependency between them, but it does not list information RAM disc. Block device hard disk, flash drive, cd-ROM and the like. lsblk command is included in util-linux-ng package, the package is now renamed util-linux. The package with several other tools, such as dmesg. To install lsblk, please download the util-linux package in here, lsblk list block device can be seen as an abbreviation. This command can also perform ordinary users, but there may appear incomplete information, it is best done by the root user, usage is as follows:

[root @ CentOS7 ~] # lsblk [options] [device]
options and parameters:
-a: show All equipment, without this option is also the default display device so
-d: list only the disk itself, and does not list the disk partition data
-f: also listed in the name of the file system disk, also displays the partition the UUID
-i: use ASCII output line, do not use complex encoding (then under certain circumstances useful)
-m: permission while the output data of the device in / dev below (rwx data)
-p: list the full file name of the device! Instead of listing only the last name only.
-t: List of detailed data of the magnetic disk apparatus, comprising a disk queue mechanism, the pre-write data size, etc.

Example 1: List all disk information
---------------- ----------------------------------------------
[root @ CentOS7 ~] # lsblk
NAME                    MAJ:MIN   RM    SIZE    RO   TYPE    MOUNTPOINT
sda                            8:0            0       20G      0      disk
├─sda1                    8:1             0      200M    0       part      /boot/efi
├─sda2                    8:2            0          1G     0       part      /boot
└─sda3                    8:3            0      18.8G    0       part
  ├─centos_centos7-root 253:0       0 16.8G  0       lvm      /
  └─centos_centos7-swap 253:1     0    2G   0       lvm      [SWAP]
sdb                          8:16          0         5G       0       disk
sr0                           11:0         1      1024M      0     rom  
[root@CentOS7 ~]#
-------------------------------------------------- ------------
above by lsblk display 7 columns names are as follows:

nAME: this is a block device's file name, plus the absolute path to see if the -p parameter.
MAJ: MIN: This column shows the major and minor number.
RM: This field shows whether the device is a removable device. Value of 1 is represented by a mobile device, in this case the value RM is equal to 1 sr0 device, indicating that he is a mobile device.
SIZE: This column lists the capacity size information devices. 20G, for example, indicates that the device size is 20GB, 200M and 200M indicates that the device size.
RO: this indicates that the device is read-only. In this case, RO is 0 for all devices, indicating that they are not read-only.
TYPE: This field shows whether the device is a partition block on the disk or disks. In the present embodiment, a magnetic disk sdb and SDA, and a read only memory sr0 (rom).
MOUNTPOINT: this column pointed out that mount point mounted equipment.

Example 2: Detail / dev / sda disk list only
------------------------------------ --------------------------
[CentOS7 the root @ ~] # lsblk / dev / SDA
NAME the MAJ: the TYPE MOUNTPOINT the RO SIZE MIN RM
SDA. 8: 0 0 20G 0 disk
. 8 ├─sda1: Part. 1 0 0 200M / Boot / EFI
├─sda2. 8: 2. 1G 0 0 Part / Boot
└─sda3. 8: Part. 3 0 0 18.8 g of
  ├─centos_centos7 the root-253: 0 0 0 16.8 g of LVM /
  └─centos_centos7 the swap-253: 0. 1 0 2G LVM [the SWAP]
[CentOS7 the root @ ~] #
--------------------------- -----------------------------------

two, blkid mainly used to block the system equipment (including swap ) file system type used, LABEL, UUID and other information query, of course lsblk -f also listed uuid. To use this command must install e2fsprogs package, UUID Universally Unique Identifier is an abbreviation of a universal unique identifier, we can mount the hard disk boot through this identifier will be much better than with the device name.

Example:
------------------------------------------------ --------------
[root @ CentOS7 ~] # blkid
/dev/sda1: SEC_TYPE="msdos" UUID="C047-AFF1" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="27509777-7b73-4dba-aefd-9d9255d376ea"
/dev/sda2: UUID="4d2d3d03-44c5-44bc-8edd-c18b0ea39493" TYPE="xfs" PARTUUID="7a5b8634-3b62-4ce9-a907-e23570a37677"
/dev/sda3: UUID="QJiGgd-5Q1d-waon-oC7I-eEow-Xs2L-S7ciHo" TYPE="LVM2_member" PARTUUID="6dfe9a85-14c6-4148-a196-206f3f689ab0"
/dev/mapper/centos_centos7-root: UUID="59f1a0bd-e5c0-47a4-b880-24c3b29dcb2c" TYPE="xfs"
/dev/mapper/centos_centos7-swap: UUID="fbabf145-0c5f-445c-87c4-283339025604" TYPE="swap"above did not line represents a file system partition, list the main types tYPE name of the device, UUID, and file systems.------------------------------------------- -------------------
[root @ CentOS7 ~] #

 

Three, dumpe2fs command information for ext2 / ext3 / ext4 file system display, the system does not support other anthology, this command can also be viewed by UUID, and volume name and so on.

dumpe2fs命令语法
  dumpe2fs [ -bfhixV ] [ -o superblock=superblock ] [ -o blocksize=blocksize ] device

dumpe2fs Common command options 

Option Description

-b print file system bad block

-o not used, check the specified serious damage to the file system

-f Force display all the information, even if some of dumpe2fs does not recognize the file system function identification.

-i display the image file system information. device specified image file path

-h displays only information superblock

-x the number of the grouped blocks shown in hexadecimal

-V display the version number and launched dumpe2fs

View a disk partition all the information
------------------------------------------ --------------------------------------------
root @ Ubuntu: ~ # dumpe2fs / dev / sda1 | command to display information more # dumpe2fs plus many more preferable to display
the dumpe2fs 1.44.1 (-24-Mar-2018)
the Filesystem name Volume: <none>
Last Mounted ON: / Home / App
the Filesystem the UUID: 8078-4ac3-a646-1ceced3831ce-c90890df
the Filesystem Magic Number: 0xEF53
the Filesystem Revision #:. 1 (Dynamic)
the Filesystem Features: has_journal the ext_attr resize_inode dir_index filetype n-
64bit flex_bg sparse_super large_file huge_file uninit_bg D eeds_recovery extents
ir_nlink extra_isize
the Filesystem the flags: signed_directory_hash
the Default Mount Options: acl user_xattr
Filesystem State: Clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 32768000
Block count: 131072000
Reserved block count: 6553600
Free blocks: 81714987
Free inodes: 32765992
First block: 0
Block size: 4096
Fragment size: 4096
Group descriptor size: 64
Reserved GDT blocks: 1024
--更多--
-------------------------------------------------------------------------------

Published 136 original articles · won praise 38 · views 260 000 +

Guess you like

Origin blog.csdn.net/Pipcie/article/details/104964689