Disk parameter Revision)

Source: Internet
Author: User
Disk parameter Revision

At some times, you may want to modify some information about the current file system. For example, you may want to modify the label name or journal parameter, or other parameters related to the hard disk running (such as whether the DMA is enabled or not ~). At this time, you need the following command functions ~

 

Mknod

I still remember saying that all devices under Linux are represented by files! But how does that file represent the device? Very easy!It is replaced by the major and minor values of the file.~ Therefore, the major and minor values have special meanings and are not randomly configured! For example, the disk/dev/HDC device used in this test machine of laruenceCodeAs follows:

 

[Root @ WWW ~] # Ll/dev/HDC * BRW -R ----- 1 Root disk 22 , 0 Oct 24   15 : 55 /Dev/ Hdcbrw -R ----- 1 Root disk 22 , 1 Oct 20   08 : 47 /Dev/ Hdc1brw -R ----- 1 Root disk 22 , 2 Oct 20   08 : 47 /Dev/ Hdc2brw -R ----- 1 Root disk 22 , 3 Oct 20   08 : 47 /Dev/ Hdc3brw -R ----- 1 Root disk 22 , 4 Oct 24   16 : 02 /Dev/ Hdc4brw -R ----- 1 Root disk 22 , 5 Oct 20   16 : 46 /Dev/ Hdc5brw -R ----- 1 Root disk 22 , 6 Oct 25   01 : 33 /Dev/hdc6

In the above table, 22 is the main device code (Major) and 0 ~ 6 is the minor device code (minor ). The device data we know about Linux is determined by these two values! For example, the common hard disk file name/dev/hda and/dev/SDA device Code are as follows:

Disk File Name Major Minor
/Dev/hda 3 0 ~ 63
/Dev/HDB 3 64 ~ 127
/Dev/SDA 8 0-15
/Dev/SDB 8 16-31

If you want to know more about the hardware device code (Major, minor) supported by the core, refer to the link on the official website:

    • Http://www.kernel.org/pub/linux/docs/device-list/devices.txt

Basically, after Linux core version 2.6, the hardware file names can be automatically generated by the system in real time. We do not need to manually create the device file. However, in some cases, we may still have to manually process the device files, such as when some services are shut down to a specific directory (chroot. In this case, mknod needs to know how to operate it!

Parameters Used

 
[Root @ WWW ~] #MknodDevice File name [BCP] [major] [minor] Options and parameters: device type: B: configure the device name to be a peripheral storage device file, such as a hard disk; C: configure the device name as a peripheral input device file, such as the mouse/Keyboard, etc.; P: configure the device name as a FIFO file; Major: main device code; minor: Secondary device code;

 

From the above introduction, we know the/dev/hdc10 device code 22, 10. Please create and check this device

[Root @ WWW ~] #Mknod/Dev/hdc10 B22 10[Root @ WWW~] # Ll/dev/Hdc10brw-R --1Root22,10Oct26 23:57/Dev/Hdc10 # The one above22And10It makes sense. Do not configure it at will!

 

Create a FIFO file named/tmp/testpipe

[Root @ WWW ~] #Mknod/Tmp/Testpipe P [root @ WWW~] # Ll/tmp/Testpipeprw-R --1Root0Oct27 00:00/Tmp/Testpipe # note! This file is not a common file. It cannot be stored here! # Delete this file after testing! Check the file type! It's p!

 

E2label

The mkfs command introduces how to configure the file system header (Label. What if I want to modify the header after formatting? You can use this e2label to modify it. What is label? Let's take a look at the windows system you used. When you open file manager, Do C/D and other slots have a name? Label (if no name is configured, the "local disk drive" is displayed)

In addition to being interesting and letting you know what the disk content is, it will also be used in some configuration file cases! For example, when we just talked about attaching a disk, isn't label name used for mounting? Currently, the centos configuration file, that is, the/etc/fstab file, uses the label name by default! What are the advantages and disadvantages of doing so?

    • Advantage: No matter how the disk file name changes, no matter which IDE/SATA interface you insert the hard disk into, because the system uses the label, the interface to which the disk is inserted will not be affected;

    • Disadvantage: If two hard disks are inserted, and the labels of the two hard disks are duplicated, It would be terrible ~ Because the system may not be able to determine which disk partition slot is correct!

Laruence has always been a tough guy, so I prefer to use the disk file name for mounting! However, if there are no special requirements, use the label to mount it! HoweverYou cannot modify the label name at will.!

 

Parameters Used

 
[Root @ WWW ~] # E2label device name new label name

 

Change the/dev/hdc6 header to my_test and check whether the modification is successful?

[Root @ WWW ~] # Dumpe2fs-H/dev/Hdc6filesystem volume name: vbird_logical<=The original header name is omitted under... [root @ WWW~] # E2label/dev/hdc6"My_test"[Root @ WWW~] # Dumpe2fs-H/dev/Hdc6filesystem volume name: my_test<=It's changed !..... Omit .....

 

Tune2fs
 
[Root @ WWW ~] # Tune2fs [-JLL] device code options and parameters:-L: similar to dumpe2fs-H Functions ~ Read the data in the superblock ~-J: Convert the filesystem of ext2 to the file system of ext3;-L: like the e2label function, you can modify the label of filesystem!

 

LIST/dev/hdc6 superblock content

 
[Root @ WWW ~] # Tune2fs-L/dev/hdc6

This command has a wide range of functions ~ The above Bird brother only lists some simple parameters. For more usage instructions, refer to man tune2fs. Interestingly, if you want to upgrade a partition to an ext2 file system and upgrade it to an ext3 file system, you can use tune2fs to convert it easily ~

 

Hdparm

If your hard disk is an IDE interface, this command can help you configure some advanced parameters! If you use the SATA interface, this command is useless! In addition, the current Linux system has been slightly optimized, so this command is used to test performance at most! It is also recommended that you do not adjust the hard disk parameters as needed. The file system is prone to problems! Unless you really know what the data you have adjusted is!

[Root @ WWW ~] # Hdparm [- Icdmxtt] device name options and parameters: - I: display the hard disk parameters detected by the core! -C: Configuration 32 -Bit (32-bit) access mode. This 32 Bit access mode refers to the transmission mode between the hard disk and the PCI interface, while the hard disk itself is still  16  Bit mode is running! By default, this configuration value is enabled. We recommend that you use C1 directly! -D: Configure whether to activate the DMA mode.-D1 is enabled ,- D0 is canceled; - M: configure the synchronous read mode for multiple sector. In general, configuring this mode can reduce the efficiency of the system's loss due to disk reading ~ However, we do not recommend this value for WD hard disks ~ Generally  16 / 32 Yes. However, the recommended WD hard disk value is 4 / 8  . The maximum value of this value can be hdparm -I/dev/ Configure maxmultsect output by hda! If you do not know, configure 16  It is reasonable! -X: Specifies the utradma mode. Generally, the udma mode value is added. 64  That is, the configuration value. In addition, the hard disk and the motherboard chip must be synchronized, so take the smallest one. Generally speaking:  33 MHz DMA mode 0 ~ 2 (X64 ~ X66)  66 MHz DMA mode 3 ~ 4 (X67 ~ X68) 100 MHz DMA mode  5 (X69) If uata is displayed on your hard disk  100  The above, the x69 configuration is also good! - T: test the cache access efficiency. -T: test the actual access efficiency of the hard disk (correct !)

 

Obtain the maximum synchronous access sector value of my hard disk and the current udma Mode

[Root @ WWW ~] # Hdparm-I/dev/ HDC Model = Ic35l040aver07- 0 , Fwrev = er4oa41a, serialno = sx0sxl98406 <= Hard drive brand model config = {Hardsect notmfm hdsw> 15 USEC fixed DTR> 10mbs} rawchs = 16383 / 16 / 63 , Trksize = 0 , Sectsize = 0 , Eccbytes = 40  Bufftype = Dualportcache, buffsize = 1916kb, maxmultsect = 16 , Multsect = 16  Curchs = 16383 / 16 / 63 , Cursects = 16514064 , LBA = Yes, lbasects = 80418240 Iordy = On/Off, tpio = {min: 240 , W /Iordy: 120 }, TDMA = {min: 120 , REC: 120  } Pio modes: pio0 pio1 pio2 pio3 pio4 DMA modes: mdma0 mdma1 mdma2 udma modes: udma0 udma1 udma2 udma3 udma4 * Udma5 <= Yes * Is the current value of advancedpm = Yes: Disabled ( 255 ) Writecache = Enabled drive conforms to: ATA /Atapi- 5 T13 1330d Revision 1  : ATA /Atapi- 2 ATA/atapi- 3 ATA/atapi- 4 ATA/atapi- 5  # This hard disk buffer memory is only 2 MB (buffsize), but it uses udma5! Yes. 

 

The maximum 16-bit/udma is mode 5 from the previous example, so you can configure it as follows:

 
[Root @ WWW ~] # Hdparm-D1-C1-x69/dev/HDC

 

Test the read performance of this hard disk

[Root @ WWW ~] # Hdparm-Tt/dev/HDC/Dev/HDC: Timing cached reads:428MBIn2.00Seconds =213.50MB/SEC timing buffered disk reads:114MBIn3.00Seconds =38.00MB/SEC # This test machine of laruence is not very good ~ Such a speed... unsatisfactory ~

If you are using a SATA hard disk, the only thing that can be done with this command is the function of the last test! Although such a test is not very accurate, it is at least a benchmark that can be compared. The results of the SATA (/dev/SDA) and RAID (/dev/sdb) tests on my Cluster machine are as follows, which can be provided for your reference.

[Root @ WWW ~] # Hdparm-Tt/dev/SDA/dev/ SDB /Dev/SDA: Timing cached reads:  4152 MB In    2.00 Seconds = 2075.28 MB/ SEC timing buffered disk reads:  304 MB In    3.01 Seconds = 100.91 MB/ Sec /Dev/ SDB: Timing cached reads:  4072 MBIn    2.00 Seconds = 2036.31 MB/ SEC timing buffered disk reads:  278 MB In    3.00 Seconds = 92.59 MB/sec

From http://vbird.dic.ksu.edu.tw/linux_basic/0230filesystem_3.php

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.