Disk parameter revision [transfer from Vbird]

Source: Internet
Author: User

at some point, you may want to modify some of the current file system information, for example, you might want to modify the Label name, or the journal parameter, or the other hard drive runtime parameters (such as DMA start or not ~). At this point, you need to have these related command functions.

Mknod

Remember when we said that all the devices under Linux are represented by files! But how does that file represent the device? Very simple! is through the file major and minor value to replace the ~ so, that major and minor value is a special meaning, not randomly configured Oh! For example, in this test machine of Brother Bird, the relevant device code of the disk/DEV/HDC used is as follows:

[Email protected] ~]# ll/dev/hdc*brw-r-----1 Root disk, 0 Oct 15:55/dev/hdcbrw-r-----1 Root disk, 1 Oct 20 0 8:47/dev/hdc1brw-r-----1 Root disk, 2 Oct 08:47/dev/hdc2brw-r-----1 Root disk, 3 Oct 08:47/dev/hdc3brw-r-  ----1 Root disk, 4 Oct 16:02/dev/hdc4brw-r-----1 Root disk, 5 Oct 16:46/dev/hdc5brw-r-----1 root Disk 22, 6 Oct 01:33/DEV/HDC6

In the table above, 22 is the main device code (MAJOR) and 0~6 is the Secondary Appliance Code (MINOR). The device data that our Linux core knows is determined by these two values! For example, the common hard drive file name/dev/hda and the/DEV/SDA appliance 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 core supported hardware appliance code (major, minor) please refer to the website link:

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

Basically, after the Linux core 2.6 version, the hardware file name can be automatically generated in real time, we do not need to manually create the appliance files. In some cases, however, we may still have to manually process the device files, such as when some services are locked down in a specific directory (chroot). At this point the Mknod has to know how to operate!

Using Parameters

[[email protected] ~]# mknod appliance file name [bcp] [Major] [Minor] options and Parameters: Device type:   B  : Configure the device name to become a peripheral storage device file, such as a hard disk;   C  : Configure the device name to become a peripheral input device file, such as mouse/keyboard, etc.   p  : Configure the appliance name to become a FIFO file; Major: main device code; Minor: Secondary device code;

By the above introduction we know/DEV/HDC10 device code 22, 10, please create and consult this device

[Email protected] ~]# MKNOD/DEV/HDC10 b 10[[email protected] ~]# ll/dev/hdc10brw-r--r--1 root root, Oct 26 23 : 57/dev/hdc10# above that 22 and 10 is meaningful, do not arbitrarily configure Ah!

Create a FIFO file named/tmp/testpipe

[[email protected] ~]# mknod/tmp/testpipe p[[email protected] ~]# ll/tmp/testpipeprw-r--r--1 root root 0 Oct 27 00:00/ tmp/testpipe#, watch out! This file is not a general document, you can not just put it here! # Please delete this file after the test is complete! Look at the type of this file! It's P Oh!

E2label

We talked about the method of configuring the File System header (label) when the MKFS command was introduced. What if you want to modify the header after formatting? Just use this e2label to modify it. So what is a Label? Let's take the Windows system you used to explain. When you open "File Explorer", does the C/D slot always have a name? That's the label (if you don't have a configuration name, the word "native disk drive" is displayed)

This thing is interesting and lets you know what the contents of the disk are, and it will be used in some configuration file cases! For example, when we were talking about a disk that was mounted, wouldn't it be useful to Label name to mount it? The current CentOS configuration file, which is the configuration of the/etc/fstab file, uses the Label name by default! What are the advantages and disadvantages of doing so?

    • Pros: No matter how the disk file name changes, regardless of which Ide/sata interface you inserted the hard disk, because the system is through the Label, so, the disk inserted in which interface will not have an impact;

    • Disadvantage: If two hard disks are plugged in, just two hard disk labels are duplicated, that's tragic ~ because the system may not be able to determine which disk partition slot is correct!

Brother Bird has always been a more "hard" style, so I prefer to use the disk file name directly to mount it! However, if there is no special need, then use the Label to mount it! But you can not change the name of the Label at will!

Using Parameters

[[email protected] ~]# E2label Appliance name  new label name

Change the/DEV/HDC6 header to My_test and see if the change was successful?

[Email protected] ~]# dumpe2fs-h/dev/hdc6filesystem volume name:   vbird_logical  <== Original header name ..... The bottom is omitted ..... [Email protected] ~]# e2label/dev/hdc6 "My_test" [[email protected] ~]# dumpe2fs-h/dev/hdc6filesystem volume name:   My_test        <== has changed! ..... The bottom is omitted .....

TUNE2FS
[[email protected] ~]# TUNE2FS [-JLL] device designator options and Parameters:  -L: Similar to dumpe2fs-h function ~ Read the data in Superblock ~-j  : ext2 filesyste M converted to ext3 file system;-l  : Similar to the E2label function, you can modify the filesystem Label Oh!

List the superblock content of/DEV/HDC6

[Email protected] ~]# tune2fs-l/DEV/HDC6

The function of this command is actually very wide ~ The above bird brother only lists a few simple parameters, more usage Please refer to man tune2fs. Interestingly, if one of your partition was originally a ext2 filesystem, if you want to upgrade him to a ext3 file system, you can easily convert it using TUNE2FS.

hdparm

If your hard drive is an IDE interface, then this command can help you configure some advanced parameters! If you are using SATA interface, then this command will not be much use! In addition, the current Linux system has been slightly optimized, so this command is most used to test performance! And it is recommended that you do not arbitrarily adjust the hard disk parameters, file system is prone to problems Oh! Unless you really know what the data you're adjusting is!

[[email protected] ~]# hdparm [-ICDMXTT] Appliance name options and parameters:  -I: Display the hard drive parameters detected by the core! -C  : Configure 32-bit (32-bit) access mode. This 32-bit access mode refers to the mode of transmission between the hard disk and the       PCI interface, while the hard disk itself is still running in 16-bit mode!      By default, this configuration value will be opened, it is recommended to use C1 directly! -D  : Configure whether to activate DMA mode,-D1 to start,-d0 to cancel;-M  : Configures the mode of reading multiple sector synchronously. In general, configuring this mode can reduce      the performance of the system due to the loss of the disk read ~ However, WD's hard drive is not recommended to configure this value ~      Generally, the configuration is 16/32 optimization, however, the recommended value for WD drives is 4/8. The      maximum value of this value can be configured using the Hdparm-i/dev/hda output maxmultsect      ! General if not know, configuration 16 is reasonable! -X  : Configures the UTRADMA mode, in general, the UDMA mode value plus 64 is the configuration value.      also, the hard disk and the motherboard chip must be synchronized, so take the smallest one. Generally: 100MHz DMA mode 0~2 (X64~X66)-MHz DMA Mode-      5 (   X69)      If your hard disk Surface display is uata 100 above, then the configuration X69 is also good!  -T: Test Cache Cache Access Efficiency-T  : Test the actual access performance of the hard disk (more correct!) )

Get the maximum sync access sector value of my hard drive with the current UDMA mode

[[email protected] ~]# hdparm-i/dev/hdc model=ic35l040aver07-0, fwrev=er4oa41a, serialno=sx0sxl98406 <== HDD's brand model config={hardsect NOTMFM hdsw>15usec Fixed dtr>10mbs} rawchs=16383/16/63, Trksize=0, SectSize=0, ECCbytes=40 BuffT Ype=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 <==  have * for current value Advancedpm=yes:dis abled (255) writecache=enabled Drive conforms to:ata/atapi-5 T13 1321D Revision 1:      ata/atapi-2 ata/atapi-3 ata/atapi- 4 ata/atapi-5# This hard disk buffer memory only 2MB (buffsize), but the use of UDMA5! It's OK.

The last example knows that the maximum 16-bit/UDMA is mode 5, so it can be configured as:

[Email protected] ~]# HDPARM-D1-C1-X69/DEV/HDC

Test the read performance of this hard drive

[[email protected] ~]# hdparm-tt/dev/hdc/dev/hdc:timing cached reads:   428 MB in  2.00 seconds = 213.50 mb/sec Ti Ming buffered Disk reads:  All-in-3.00 seconds =  38.00 mb/sec# This test machine of bird brother is not very good ~ such speed ..... Passable ~

If you are using a SATA hard drive, the only thing that can be done with this command is the function of the test at the back. Although such a test is not very accurate, it is at least a benchmark that can be compared. Brother Bird on my cluster machine test SATA (/DEV/SDA) and RAID (/DEV/SDB) results as follows, can provide you with reference to see.

[[email protected] ~]# hdparm-tt/dev/sda/dev/sdb/dev/sda:timing cached reads:   4152 MB in  2.00 seconds = 2075.2 8 mb/sec Timing Buffered disk reads:  304 MB in  3.01 seconds = 100.91 mb/sec/dev/sdb:timing Cached reads:   407 2 MB in  2.00 seconds = 2036.31 mb/sec Timing buffered disk reads:  278 MB in  3.00 seconds =  92.59 mb/se C

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

Disk parameter revision [transfer from Vbird]

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.