Disk management: hard disk, partition, file system | How to view disk information

1 Introduction

Introduction

Disk management is a very important part of the operating system. We need to know how to view installed disk information and how to manage these disks.

Purpose

This article will introduce the basic concepts of disk management, including hard disks, partitions, file systems, etc., and introduce two commonly used commands: lsblk and blkid to view installed disk information.

2. Disk management

Hard drive and partition

A hard drive generally refers to a physical device in a computer that can be used to store data. The partition is a logical division of the hard disk. Each partition is like an independent hard disk and can independently assign file systems and set file permissions.

File system

A file system refers to how files are stored and organized on disk. Common file systems include ext4, NTFS, FAT32, etc.

3. Command to view installed disks

lsblk

lsblk is a commonly used command that lists information about installed disks in the system.

parameter

  • -a displays all devices, including virtual devices and loopback devices.
  • -b Displays the device size in bytes.
  • -d displays only disk devices, not partitions.
  • -f displays the file system.
  • -i displays all block devices, including block devices such as RAM disks and loopback devices.
  • -l Displays only the block device list, ignoring any other parameters.
  • -O This option outputs a standard arrangement suitable for the given target operation.
  • -o Display specified columns.

Output format

The lsblk command displays disk information in a tree structure in the terminal.

  • NAME device name.
  • FSTYPE The file system type of the device. If the device is not formatted, this column is empty.
  • MOUNTPOINT The device's mount point. If the device is not mounted, this column will be empty.
  • LABEL The volume label name of the device.
  • SIZE device size.

Example

# 查看所有磁盘设备
$ lsblk -d
sda     8:0    0 931.5G  0 disk 
sdb     8:16   0 232.9G  0 disk 

# 显示所有块设备
$ lsblk -i
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
ram0    1:0    0   2.9G  0 disk 
ram1    1:1    0   2.9G  0 disk 
ram2    1:2    0   2.9G  0 disk 
...
sda     8:0    0 931.5G  0 disk 
sdb     8:16   0 232.9G  0 disk 
sr0    11:0    1  1024M  0 rom  

blkid

The blkid command is used to find information such as the file system type and UUID of a block device.

parameter

  • -p Used with the -u option to print to non-local storage devices.
  • -t TYPE can be used to limit the types of devices to be searched.

Output format

The format of blkid command output is usually as follows:

  • /dev/sda1: device name and partition number.
  • UUID="2C7B-3D99": UUID of the device.
  • TYPE="vfat": The file system type of the device.
  • PARTLABEL="Sony_system": GPT label of the partition.

Example

# 查看磁盘设备的 UUID 和文件系统类型
$ blkid /dev/sda1
/dev/sda1: UUID="2C7B-3D99" TYPE="vfat" PARTLABEL="Sony_system" PARTUUID="edf484f7-ec1e-49c6-b334-a4d377ce3174"

4. Summary

This article introduces the basic concepts of disk management, including hard disks and partitions, file systems, etc. And introduces two commonly used commands: lsblk and blkid to view installed disk information. Hope this article is helpful to readers.


Recommended Python boutique columns


Basic knowledge of python (0 basic introduction)

[Python basics] 0.print() function
[Python basics] 1. Data types, data applications, data conversion
[ Basic knowledge of python] 2. If conditional judgment and nesting of conditions
[Basic knowledge of python] 3. input() function
[Basic knowledge of python] 4. List and dictionary
[Python basic knowledge] 5. for loop and while loop
[Python basic knowledge] 6. Boolean values ​​and four kinds of statements (break, continue, pass, else)
[Basic knowledge of python] 7. Practical operation-Using Python to implement the "Text PK" game (1)
[Basic knowledge of python] 7 .Practical operation - Use Python to implement the "Word PK" game (2)
[Basic knowledge of python] 8. Programming thinking: how to solve problems - Thinking
[Basic knowledge of python] 9. Definition and calling of functions
[Basic knowledge of python] 10. Writing programs with functions - practical operation
[Basic knowledge of python] 10. Use Python to implement the rock-paper-scissors game - practical operation of functions
[Basic knowledge of python] 11. How to debug - Common error causes and troubleshooting ideas - Thinking
[Python Basics] 12. Classes and Objects (1)
[Python Basics] 12. Classes and Objects (2)
[Python Basics ] 13. Classes and Objects (3)
[Basic Knowledge of Python] 13. Classes and Objects (4)
[Basic Knowledge of Python] 14. Library Management System Construction (practical operation of classes and objects)
[Basic knowledge of python] 15. Basic knowledge of coding
[Basic knowledge of python] 16. Basics and operations of file reading and writing
[Basic knowledge of python] 16. Python implementation of "Ancient Poetry Dictation Questions" (File Reading, Writing and Coding - Practical Operation)
[Basic knowledge of python] 17 .The concept of modules and how to introduce them
[Python basics] 18. Practical operation - using python to automatically send mass emails
[Python basics] 19. Product thinking and The use of flow charts - Thinking
[Basic knowledge of python] 20. Python implementation of "What to eat for lunch" (Product Thinking - Practical Operation)
[python Basic knowledge] 21. The correct way to open efficiently and lazily - Graduation
[python file processing] Reading, processing and writing of CSV files
[python file Processing】Excel automatic processing (using openpyxl)
[python file processing]-excel format processing


python crawler knowledge

[python crawler] 1. Basic knowledge of crawlers
[python crawler] 2. Basic knowledge of web pages
[python crawler] 3. First experience with crawlers (BeautifulSoup analysis)
[python crawler] 4. Practical crawler operation (dish crawling)
[python crawler] 5. Practical crawler operation (crawling lyrics)
[python crawler] 6. Practical crawler operation (requesting data with parameters)
[python crawler] 7. Where is the crawled data stored?
[python crawler] 8. Review the past and learn the new
[python crawler] 9. Log in with cookies (cookies)
[python crawler] 10. Command the browser to work automatically (selenium)
[python crawler] 11. Let the crawler report to you on time
[python crawler] 12 .Build your crawler army
[python crawler] 13. What to eat without getting fat (crawler practical exercises)
[python crawler] 14. Scrapy framework explanation
[python crawler] 15. Scrapy framework practice (crawling popular positions)
[python crawler] 16. Summary and review of crawler knowledge points

Guess you like

Origin blog.csdn.net/qq_41308872/article/details/133921461