In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian for you to introduce in detail "how to use the lsblk command to view block devices in Linux", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to use the lsblk command to view block devices in Linux" can help you solve your doubts.
The lsblk command lists information about all available block devices, such as what we call logical disks, while df-h looks at the file system level. The lsblk command is included in the util-linux package, yum installs the util-linux package, and util-linux contains multiple command tools.
Install lsblk in Linux
The default base installation in Linux does not have the command lsblk, so how can you use lsblk?
Yum is used to install the service installation software in the centos series. Do you need yum-y install lsblk to install this command?
NO, that's not true. It's tricked again, isn't it?
The lsblk command is included in the util-linux-ng package, which is now renamed util-linux. This package comes with several other tools, such as dmesg. To install lsblk, download the util-linux package here.
Users of the Fedora series (centos, RHEL, etc.) can install the package in the following ways:
# yum install util-linux-ng there are several options for this command:
Default option
The lsblk command lists all block devices in a tree by default. Open the terminal and enter the following command:
$lsblk
The output is as follows:
Lsblk defaultlsblk default
The seven columns are named as follows:
NAME: this is the name of the block device. MAJ:MIN: this column shows the primary and secondary device numbers. RM: this column shows whether the device is removable. Note that in this example, the RM values of devices sdb and sr0 are equal to 1, indicating that they are removable devices. SIZE: this column lists the capacity size information of the device. For example, 298.1g indicates that the size of the device is 298.1GB, while 1K indicates that the size of the device is 1KB. RO: this item indicates whether the device is read-only. In this case, all devices have a Ro value of 0, indicating that they are not read-only. TYPE: this column shows whether the block device is a disk or a partition on the disk. In this example, sda and sdb are disks, while sr0 is read-only storage (rom). (LCTT translation note, here the RO entry of sr0 is not marked as 1, there may be some errors? ) MOUNTPOINT: this column indicates the mount point of the device. List all devices:
The default option does not list all empty devices. To view these empty devices, use the following command:
$lsblk-a
This option lists all devices, including empty devices.
Lsblk bytes sda
Lsblk bytes sda
List device permissions and owners:
The lsblk command can also be used to list the ownership relationships of a particular device, as well as groups and patterns. You can obtain this information with the following command:
$lsblk-mlsblk permissionslsblk permissions lists the specified devices:
This command can also get only the information about the specified device. This can be achieved by specifying the device name after the options provided to the lsblk command. For example, you may be interested in knowing how to display your disk drive size in bytes, then you can do this by running the following command:
$lsblk-b / dev/sda
Or, the following command is equivalent:
$lsblk-- bytes / dev/sda lists the devices that do not lead in the form of a list:
You can also combine several options to get the specified output. For example, you might want to list devices in a list format instead of the default tree format. You may also be interested in removing headings from different column names. You can combine two different options to get the desired output, as follows:
$lsblk-nl
Alternatively, you can use the long options below, which also give the same output.
$lsblk-- noheadings-- listlsblk no header and listlsblk no header and list lists SCSI devices:
To get a list of SCSI devices, you can only use the-S option. This option is an uppercase S and cannot be confused with the-s option, which is used to print dependencies in reverse order.
$lsblk-S
Lsblk lists SCSI devices, and-s is the reverse option, which gives the following output. Enter the command:
$lsblk-s
Or
Lsblk-inverse has read this article, "how to use lsblk commands in Linux to view block devices" article has been introduced, want to master the knowledge of this article still need to practice and use in order to understand, if you want to know more related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.