Linux System Management HDD Management

Source: Internet
Author: User
Tags ide hard drive

Hard disk is one of the important components of computing, hard disk for the operating system to provide persistent memory, the performance and quality of Linux hard disk devices may be related to the security of the build line and user experience, and so on. Mastering the information about hard drive management can help us deal with these problems.
#
The most important philosophy in Linux is all files, hard disk devices are no exception, in Linux system hard disk devices generally stored in the/dev/under the SATA, SCSI and other interface types of hard disk using SD, the first SD hard disk is represented as/DEV/SDA, The second SD hard drive is represented as/DEV/SDB. The IDE hard drive uses HD to indicate that the first HD hard drive is represented as/DEV/HDA, and the second HD hard drive is represented as/DEV/HDB. And so on
#
#
Below are the Linux and hard disk related commands

mount          挂载指定设备    格式:mount -t 文件系统类型(通常mount命令会自动识别)  设备路径  挂载点    示例:    mount /dev/sda1  /mnt/                  #将/dev/sda1 挂载到/mnt    mount /dev/cdrom /media/     #将cdrom(光盘设备)挂载到/media    mount -a                                        #重读/etc/fstab文件umount            卸载指定设备  格式:umount 设备/挂载点  示例:       umount /dev/sda1           #卸载/dev/sda1 卸载到整个设备,比如说这个分区一共挂载到了/mnt /test /test1那么这三个挂载点的挂载都将卸掉       umount /media/             #卸载挂在/media目录上面的设备
df  查看当前系统挂载的分区情况    格式        df 参数    常用参数        --help       查看帮助信息        -i              显示inode情况        -h             自动计算显示的文件系统大小单位        -k             以kb方式大小输出文件系统大小        -l              只显示本地文件系统的信息        -T            显示文件系统类型        -t             只显示指定的文件系统
  tune2fs Adjust File system Property format: TUNE2FS parameter Partitioning common parameters:-j upgrade ext2 to ex without damaging legacy data T3-l set or modify the volume label (volume name)-m adjust the percentage reserved to Superuser (root), the default is 5%-C to specify the number of mounts to n After a self-test, 0 or 1 means to turn off this feature-I do a self-test after each mount using how many days, 0 or 1 means turn off this feature-l displays information in the Super block  
SMARTCTL: (not supported for servers such as virtual machines or cloud hosts) Smartctl is a command-line tool for Smart on UNIX-like systems that print smart self-test and error logs, enable or disable Smrat automatic detection, and initialize device self-test operations        Smartctl is useful for Linux physical servers where you can perform error checking on a smart disk and extract the disk information associated with hardware RAID installation: Yum-y install smartmontools common options:                             -I printing device brief information, such as serial number, speed, etc.-s setting whether to turn on smart function-a                  Output all smart information about a specified hard drive-H print device health-T sub-parameter                     Perform a test operation that will have a little impact on the performance of the hard disk when testing. Common sub-parameters: Offline offline test short          Run a short time self-test (typically no more than 10 minutes) long runs extended self-test (typically longer than 1 hours) select,n-m, Choose to test a disk block of a specified range instead of an entire hard drive example: smartctl-i/dev/sdb Check if Smart is enabled, the last behavior of the output device does not the support SM ART indicates that Smart is not supported, the last behavior of the output smart support is:disabled represents the last act of disabling smart, the output of smart support Is:en Abled indicates that smartctl-s on/dev/s is enabledDB Enable smart feature of hard drive smartctl-s off/dev/sdb Disable smart function of hard drive smartctl-a/dev/sdb view hard Drive details Key field Description: Raw_read_error_rate: Underlying data read error rate Rotation rates: hard drive RPM information , SSD displays solid state Device User Capacity: Hard drive capacity Start_stop_count: Hard Disk power-up times power_on_hours: HDD Cumulative use Time (hours) Power-off_retract_count: The number of times the hard drive is not properly closed (suddenly        The number of times the hard disk is forced to be hot-swappable) Temperature_celsius: Hard Drive temperature seek_error_rate: Seek error rate Smartctl-h/dev/sdb Get the health status of the device Smartctl-t Short/dev/sdb for a short time intelligent test smartctl-l self Test/dev/sdb View the self-test results of the hard disk smartctl-c/dev/sdb calculate the approximate value of the test time smartctl-l Error/dev/sdb hit Print hard Drive error log
The hdparm:hdparm command provides a command line interface for reading and setting the IDE or SCSI hard disk parameter installation at the drive level: yum-y install hdparm command format: hdparm parameter device                    Common parameters:-H View Help information-I get hard drive details such as serial number, hard drive relay, interface type, etc.-t Evaluates the read speed of the hard drive (without HDD cache)-T evaluates the read efficiency of the hard drive cache (frequently used data cached in memory)-a sets the pre-read function of the hard disk for        Significant performance gains from reading large files-a 0/1 cache when you start or close a read file-F writes the memory buffer's data to the hard disk and empties the buffer (similar to the Rain Sync command) --direct is typically used with the-t or-t parameters, test hard disk read speed with raw IO, better indicate raw device and driver performance--drq-hsm-error very dangerous commands, use only when simulating a failure in a test environment        , do not use the-G display drive in the build environment of the magnetic track, magnetic head, Magnet region and other parameters-I display hard disk hardware specification information, this information is provided by the hard disk itself when booting                      -I directly read the hardware specifications provided by the hard drive (read and read hard drive information from the drive)--make-bad-sector very dangerous command, only used in the test environment to simulate the failure,                      Do not use in the build environment (intentionally creating a bad sector to test the capabilities of a raid and other devices to check the sector)-R set the hard disk to self-read mode-S      Set the wait time before the hard drive enters power save mode  -y force IDE drive immediately into standby mode-y Force IDE drive to enter sleep mode now-W        To set a write cache example for a hard disk: Hdparm-i/dev/sha #获取硬盘的详细信息 hdparm-c/dev/sda #检测硬盘的电源管理模式 Hdparm-t #测试硬盘的读取速度 (without cache) Hdparm-t #测试硬盘快取的读取速 Degrees Hdparm-tt--DIRECT/DEV/SDA #测试硬盘的真实读取速度
其他的一些相关命令:fsck    检查并修复linux中的文件系统    格式:        fsck 参数 文件系统分区    常用参数:    -t    指定文件系统类型    -a    自动修复e2fsck    专用于修复ext系列的文件系统    格式:        e2fsck  参数  文件系统分区    常用参数:            -f    强制检查    -p    自动修复mke2fs    专门管理ext系列的文件系统    格式:        mke2fs  参数  文件系统分区    常用参数:    -j    创建ext3类型的文件系统    -b    指定块大小,默认为4096,可以值有,1024、2048.4096    -L    指定卷标    -m    指定预留给超级用户的块数百分比    -E    指定额外文件系统属性blkid    查看当前磁盘设备的相关属性    格式:        blkid 文件系统分区        字段说明:        UUID:磁盘的唯一标识符   TYPT:文件系统类型 LABEL:卷标e2label    查看或重新定义卷标    格式:        e2label 文件系统分区  [卷标名]       示例:        e2label /dev/sda1          查看卷标名        e2label /dev/sda1 test     设置卷标名其他命令:    lscpu    用于查询CPU信息    lshw     用于显示硬件信息表    hwinfo   用于查询硬件信息    lsppci   用于列出PCI总线的信息以及连接到PCI总线上的设备信息    lsblk    用于列出块设备的信息    lsscsi   用于列出SCSI的设备信息

Linux System Management HDD Management

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.