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 is a description of Linux and hard disk related commands (different hairstyle version of the command may not be the same)

Mount Mount      specified device
-T file system type (usually the Mount command is automatically recognized) device path mount point
Example:
MOUNT/DEV/SDA1 /mnt/ #将/dev/sda1 mount to/mnt
mount/dev/cdrom/media/#将cdrom (Optical device) mount to/media
Mount-a #重读/etc/fstab file


Umount uninstalling a specified device
Format: Umount device/mount point
Example:
UMOUNT/DEV/SDA1 #卸载/dev/sda1 unloaded to the entire device, for example, this partition is attached to the/mnt/test/test1 so the mount of the three mount points will be removed
umount/media/ #卸载挂在 The device above the/media directory

DF to view the current system mount partition condition
Format
DF parameter
Common parameters
--help Viewing Help information
-I display inode condition
-H automatically calculates the displayed file system size units
-k output file system size in KB size
-L Only displays information about the local file system
-T display file system type
-T displays only the specified file system

TUNE2FS   Adjusting File System Properties
Format:
TUNE2FS parameter Partitioning
Common parameters:-j upgrade ext2 for ext3-l setting or modifying the volume label (volume name)-M Adjust the percentage of reserved to Superuser (root) without damaging the original data, by default, the 5%-c specifies that the number of mounts is reached n times after the self-test, 0 or 1 means turn off this feature- I perform a self-test after each mount using a number of 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 the specified range of disk blocks instead of the entire hard drive example: smartctl-i/dev/sdb Check if Smart is enabled, the last behavior of the output device does not su Pport Smart indicates that Smart is not supported, the last behavior of the output smart support is:disabled means that smart support is disabled, the last behavior of the output smart support is:enabled means that SMARTCTL is enabled-       s ON/DEV/SDB enable smart features for hard drives Smartctl-s Off/dev/sdb Disable the smart feature of the hard drive smartctl-a/dev/sdb view hard drive Details key field Description:                Raw_read_error_rate: Low-level data read error rates Rotation rate: hard drive RPM information, SSD display solid state Device User Capacity: Hard disk capacity Start_stop_count: Hard drive power up times power_o                N_hours: Hard disk cumulative duration (hours) Power-off_retract_count: The number of times the hard drive was shut down unexpectedly (or the number of times a hot-swappable hard drive was forced)             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 smart Test smartctl-l selftest/dev/sdb View the self-test results of the hard drive Smartctl-c/dev/sdb Calculate the approximate value of the test time smartctl-l error/dev/sdb print hard disk 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 Set the pre-read function of the hard disk, there is a significant performance increase for reading large files-a 0/1 cache when you start or close the read file-f writes the memory buffer's data to the hard disk and empties         Buffers (like the Rain Sync command)--direct are typically used with the-t or-t parameters, test hard disk read speed with raw Io, and better indicate the performance of raw devices and drivers--drq-hsm-error Very dangerous command, only in the test environment to simulate the failure to use, in the production environment do not use the-G display hard disk magnetic track, head, magnetic region and other parameters-I display the hard disk Hardware specification information, which is the hardware specification information provided by the-I direct read hard drive provided by the hard disk itself at boot time (read and read hard drive information from drive)--make-bad-sector very dangerous.                      command that is used only when simulating a failure in a test environment, do not use (intentionally creating a bad sector to test the capabilities of a RAID device to check sectors)-R to set the hard disk to self-read mode-S Set the hard drive into the power saving mode beforeWait time-y Force IDE drive to enter Standby mode now-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 #检 Power management mode of the hard drive hdparm-t #测试硬盘的读取速度 (without the cache) Hdparm-t #测试硬盘快取的 Read Speed Hdparm-tt--DIRECT/DEV/SDA #测试硬盘的真实读取速度
  Some other related commands:

Fsck checks and repairs the file system in Linux
Format:
fsck parameter File system partition
Common parameters:-T specifies the file system type -a automatic repair e2fsck dedicated to repairing the EXT series file system
Format:
E2fsck parameter file system partition
-F Force check -P automatic repair MKE2FS specifically manages the EXT series of file systems
Format:
MKE2FS parameter file system partition
Common parameters:-j Create ext3 type of file system-B Specifies the block size, default is 4096, can be value has, 1024, 2048.4096-l specified volume label-m specifies the percentage of blocks reserved to Superuser-e Specify additional file System Properties Blkid View the relevant property formats for the current disk device :
Blkid File system partition
Field Description:
UUID: Disk Unique identifier Typt: File system Type Label: Volume label E2label View or redefine the volume label format:
E2label file system partition [volume label name]

Example:
E2LABEL/DEV/SDA1 View Volume label names
E2LABEL/DEV/SDA1 Test Set Volume label name

Additional commands: lscpu for querying CPU information LSHW for displaying hardware information tables HWInfo for querying hardware information LSPPCI Information used to list the PCI bus and device information connected to the PCI bus lsblk information for listing block devices LSSCSI device information for listing 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.