Linux device files (/dev)

Linux device files can be divided into two categories

  • b : By block, random access device (block device file) such as: hard disk
  • c : by character, linear device (character device file) such as: keyboard

Device files are located under /dev

  

Major number: Identifies the device type

Minor number: Identifies different devices of the same type

 

Create device file

mknod (options) (arguments)

Options

- Z: Set security context;
 - m: Set permission mode;
 - help: Display help information;
 --version: Display version information.

parameter

filename: the filename of the device to be created;
Type: Specify the type of device file to create;
Major device number: specify the major device number of the device file;
Minor Number: Specify the minor number of the device file.

Example

mknod /dev/ttyUSB32 c 188 32

 

Hard disk device file name

IDE ATA --hd

STAT --sd

SCST  --sd

USB     --sd

View hard disk devices under /dev

sda is the primary hard drive

sda1 - sda4 primary partition, there are at most 4 primary partitions

sda5 logical partition

 

View current partition

Command: fdisk

Detailed explanation of fdisk command to operate disk - add, delete, convert partition, etc.

 

* means primary partition

The command fdisk + hard disk device can create partitions

 

The current system recognized partitions are saved in the cat /proc/partitions file

The partprobe command makes the system reread the partition table, which needs to be executed manually after the partition is created

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325584935&siteId=291194637