Notes on Linux private food for laruence (14)-hardware configuration and management

Source: Internet
Author: User
1. the device file Linux follows the Unix style & amp; 26684; and treats all devices as one file device file in two ways: block device file (B ): for example, hard drive and optical drive character device files (c): for example, serial port and keyboard device files are generally stored in the dev directory. 2. commonly used block devices

I. device files

Linux follows the Unix style and treats all devices as a file.

There are two types of device files:

Block device files (B): such as hard disks and optical drives

Character device file (c): such as serial port, keyboard

Device files are generally stored in the/dev directory.

II. Common block device files

/Dev/hd [a-t]: IDE device

/Dev/sd [a-z]: SCSI devices include SATA devices and USB disks.

/Dev/fd [0-7]: standard soft Drive

/Dev/md [0-31]: soft raid device

Loop [0-15]: Visit the device locally

Ram [0-19]: Memory

3. device files with common characters

/Dev/null: infinite data receiving device

/Dev/zero: unlimited zero resources

/Dev/tty [0-31]: Virtual Terminal

/Dev/ttyS [0-9]: serial port

/Dev/lp [0-3]: parallel port

/Dev/console: console

/Dev/fb [0-31]: framebuffer

4. Connect device files with common symbols

/Dev/cdrom ---->/dev/hd [a-t], sd [a-z]

/Dev/modem ----->/dev/ttyS [0-9]

/Dev/pilot ----->/dev/ttyS [0-9]

5. use of device files

You can perform operations on the device by operating on the device file.

Echo hell>/dev/tty2

Display 'Hello' on the second tty terminal'

Cp/dev/fd0/dev/fd1

Attach the floppy disk in the first floppy disk to the floppy disk in the second floppy disk.

Dd if =/dev/hda of =/root/mbr bs = 512 count = 1

Back up the mbr File in the/root directory on the first hard disk.

VI. dd command

The dd command is a powerful copy command.

Supports file format conversion during File copying.

Supports replication within a specified range

Common parameters

If = File name: specifies the source file

Of = File name: specifies the target file

Bs = xxx: specify the block size

Count = n: specifies the number of copies.

If is equivalent to <of equivalent>

VII. mknod

The system user can use the mknod command to create the required device file.

Syntax: mknod file name file type master number slave number

The master number and slave number can be in

/Usr/share/doc/MAKEDEV-3.15.2/devices.txt find

You can also use MAKDEV to create

8. hard disk structure

For each hard disk

Master Boot Record/MBR

Hard disk Partition Table/Standard Partition Table/SPT

Primary Partition/Primary Partition

Extended Partition/Extended Partition

Logical Partition/Logical Partition

9. hard disk partitioning

A hard disk can only have four partitions.

You can or can only change one primary partition to an extended partition.

In extended partitions, you can create logical partitions using a chain table.

Generally, the minimum physical unit of a hard disk is a sector.

Primary boot zone: stores disk boot information. MBR can only record four partitions (primary partition and extended partition), and only one extended partition can exist. Therefore, you can use the following partitioning method at most:

P + P

P + E

Primary partition:

Extended partitions: stores additional partition information (the primary boot partition MBR can only record four partitions). extended partitions cannot be used directly. they must be divided into logical partitions. considering disk continuity, we recommend that you place the extended partition in the last cylindrical area.

If a hard disk is installed on the primary disk of IDE1, it is divided into six partitions. what is the code of each partition?

The first partitioning method:

Method 2:

There are two partitioning methods above, and other partitioning methods. The first sector at the beginning of each partition has a special fast, called a super block, method 1: The extended partition points to the Super block of/dev/hda4, and the extended partition points to the Super block of/dev/hda2.

Note that the Second Partition method above,/dev/hda2/dev/hda3/dev/hda3 has been reserved, so the extended partition starts from/dev/hda5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.