Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Find details block device with Linux blkid command     - CentOS6.3 build a Python 3.3 environment to access Oracle 11gR2 (Database)

- Between the two to achieve the main MySQL database synchronization from (Database)

- Fedora 21 setting boot script (Linux)

- Subsequent binary search tree traversal sequence (Programming)

- Linux iptables: basic principles and rules (Linux)

- Keepalived + Nginx Installation and Configuration (Server)

- Django template inheritance child (Programming)

- How to install and use the malware detection tool LMD and ClamAV antivirus engine on Linux (Linux)

- CentOS 7 Test Marathon start Docker container (Server)

- Ubuntu 14.10 / 14.04 / 12.04 How to install Kodi 14.0 RC3 (Linux)

- RHEL7.0 environment Linux kernel upgrade (Linux)

- Linux RAID Set RAID 10 or 0 + 1 (Linux)

- ASM learning overview (Database)

- Oracle user lock how to know what causes (Database)

- Oracle online redefinition (Database)

- Use of the storage-level replication technology will quickly clone a ASM database to the target environment (Database)

- Analysis of Java keyword final (Programming)

- Memcached distributed caching (Server)

- Use regular expressions to check whether the input box to enter a URL (Programming)

- Bash job control (Linux)

  Find details block device with Linux blkid command
  Add Date : 2017-08-31      
  Today we'll show you how to use lsblk and blkid tool to find information about the block device, we are using a computer with CentOS 7.0 machine.


lsblk Linux is a tool that displays information about your system of all available block devices. It gets information from the sysfs file system. By default, this tool will be displayed in a tree format (in addition to the virtual memory disk) all block devices.

lsblk default output

By default lsblk will block device output in a tree format:

NAME - name of the device

MAJ: MIN - Linux operating system, each device to a file representation of the block (disk) devices, the major and minor device numbers used here to describe the device.

RM - removable devices. If this is a mobile device will display 1, 0 otherwise.

TYPE - the type of device

MOUNTPOINT - equipment mounted position

RO - For read-only file system will be displayed here 1, 0 otherwise.

SIZE - capacity of the device

The owner of the display device

To display the owner of the device-related information, including their user file, group, and file system mount mode, you can use the -m option, like this:

lsblk -m

Lists devices block

If you only want to list the devices, rather than want them to output a tree, you can use the -l option:

lsblk -l
Use in scripts

Advanced tip: If you want to use in the script and want to exclude the header, so you can use the -n option:

lsblk -ln


blkid command is a command-line tool that displays information about the available block devices. It can identify a block device type of content (such as file systems, swap) and acquired from the content metadata (such as a label, or UUID fields) properties (such as tokens and key-value pairs). It mainly has two types of effects: with the specified key to search for a device, or display one or more device pairs.

blkid use

Do not add any parameters directly blkid will run all available output devices, their universally unique identifier (UUID), file system type and volume label (if set).

# Blkid

Equipment listed by name or UUID

If you want to display information about a particular device, you can name the device as an option added after blkid:

# Blkid / dev / sda1
If you know the UUID of a device and want to know the device name, you can use the -U option, like this:

# Blkid -U d3b1dcc2-e3b0-45b0-b703-d6d0d360e524


If you want to get more detailed information, you can use the -p option and -o udev to use them neatly displayed format, like this:

# Blkid -po udev / dev / sda1

Reset Cache

Sometimes the device list may not be updated, if this is the case you can use the -g option to clean blkid cache, thereby removing the device does not already exist.

# Blkid -g
- Ubuntu Locale configuration problem solving Can not set LC_CTYPE (Linux)
- Oracle Sql Loader tool has shown signs (Database)
- Why learn Java EE (Programming)
- Deep understanding of C # generics (Programming)
- Debian 8.2.0 (Jessie) fast clean installation tutorial (Linux)
- C # DateTime structure common method (Programming)
- 20 Linux commands interview questions and answers (Linux)
- RHEL6 install Python and other packages from source (Linux)
- Oracle how to maintain the consistency of read? (Database)
- Docker startups use continuous integration deployment (Server)
- How to Create a file can not be changed under Linux (Linux)
- Ubuntu users to install the system indicator SysPeek 0.3 (Linux)
- ActiveMQ5.11.1 and JDK version matching relation (Linux)
- Linux Powerful command Awk Introduction (Linux)
- RHEL6.5 replace local YUM source (Linux)
- NGINX Plus now fully supports HTTP / 2 (Server)
- Configuring s3c-linux- appears Unable to find the QT3 installation (Linux)
- Vmstat command Linux Performance Monitoring (Linux)
- Ubuntu batch scp to copy files without password (Linux)
- Linux install Samba file sharing server (Server)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.