Storage Management for Linux

Source: Internet
Author: User


Linux Storage Management
Type of disk interface:
IDE: Parallel interface, from ata,133mbps,266mbps
SCSI: Small computer system interface,
Sata:serial ATA serial interface;


SAS: Serial Interface

Usb:


Another indicator for measuring disk IO capability: IOPS
IDE: Mechanical Disk 50-100 IOPS
SCSI: Mechanical Disk 100-200 IOPS
Solid-state disk, up to IOPS

SATA: Mechanical Disk IOPS
SSD Disk IOPS

SAS: Mechanical Disk IOPS
Solid State Drive IOPS

SSD for PCI-E interface:
Read the iops:400000-800000
Written by iops:50000-100000

The interface of the disk controller on the common X86 motherboard:
Ide:2 interface, one main disk per interface and one slave disk, a total of 4 disks, if there is an optical drive, it may be reduced to 3 disks + 1 optical drives;

Sata:4-6 an interface;

Scsi:7 an interface or 15 interfaces;

sas:1023-16384 an interface;

CPU: Control bus, data bus, address bus;



Linux Storage Management (2)
Mechanical Disk:
Terms:
Track: A projection of the trajectory of a magnetic head on the surface of a disk;
Sector: Sector, 512Byte, now referred to as the sector, is actually the average; min. management Unit;
Cylinder: A cylindrical surface in which a cylinder is projected from a track to all platters, and is actually composed of a track of the same position on all platters;
Partition: partition, from one cylinder to another cylinder between all the cylinder storage space;
Head: The head, each magnetic surface of each disk has a oh a head, for data read and write operations;

Metrics for disk performance:
Spindle speed: The number of revolutions per minute of disk rotation;
Average seek time:
Cache:

/dev is used to store the mapped files of the hardware device, and the disk's device files are also stored here;
Device files: The access portals associated to the drivers and devices of the hardware device;

Device number:
Major,minor

Major: The main device number, which distinguishes the device types of different devices, is used to indicate the driver required by the device;
Minor: Secondary device number, different equipment in the same type of equipment, used to provide access to the device entrance;

Device Type:
Block device:
A device that randomly accesses a block as a basic unit, usually a device that stores data;
Character Device:
A device that accesses linearly in bytes as a basic unit, usually a device that processes data;

Device file name:
IANA--ICANN

/dev
IDE:HD[A-D]
scsi| sata| sas| usb:sd[a-z]+

Redhat Enterprise Linux starts with RHEL6, and the IDE interface's disk is also named sd*, and since then all disk devices have been uniformly named sd[a-z]+

How devices are referenced:
1. Device file name
2. Volume label (Volume lable)
3.UUID: globally unique identifier; Universal unique IDentifier

Mknod
Mknod-Create block-specific or character-specific files

Format:
Mknod [Options] ... name TYPE [Major minor]


How do I use a new disk device?
1. Let the Linux system kernel identify the device and partition the device;
2. Formatting
Low-level format: disk initialization, track division;
Advanced formatting: Creating or rebuilding a file system;
3. Using the file system:
Mount
Unloading

Why partition?
1. Optimize disk IO performance;
2. You can achieve a quota limit on a storage space;
3. Perform high-speed disk problem repair;
4. Isolate system files and other application files;
5. Install multiple operating systems;

How to partition?
MBR: The entire disk space is less than 2TB capacity, the MBR partition format is recommended;
Mbr:master boot record, master boot recording, started in 1982;
MBR is also a piece of data, the default is saved in the track 0 track 0 sector;
is divided into three parts:
446bytes:boot Loader, boot loader program;
Windows:btldr
System Management for Linux: Lilo,grub (default)
64bytes:partition table, partition table; Each 16Bytes is a section that indicates the inner part of a song partition, so the default is up to four partitions;
1. A maximum of 4 primary partitions
The partition number is: 1,2,3,4
2. If you want to divide the number of partitions, you can change any primary partition to an extended partition and recommend logical partitioning in the extended partition;
The number of logical partitions starts from 5, regardless of whether the previous four digits are occupied;


Note: An extended partition can have no, up to one

2BYTES:MBR end tag, 55AA

GPT: GPT partition format is recommended for full disk space exceeding 2TB capacity;
GUID Partition table, supports 128 primary partitions;

Common partitioning tools for Linux:
Fdisk
For creating and managing MBR partitions, you can manage up to 15 partitions on the same disk

Gdisk:gun disk
Used to create and manage GPT partitions;

Attention:
If you use Fdisk or the Gdisk command to partition the remaining space of a disk that already has a partition mounted, it will not be immediately recognized by the kernel even if the result of the partition is saved.

To allow the kernel to recognize such new partitions, the following methods can be used;
1. Restart the computer;
2. Force the kernel to reread the partition table:
Partprobe command
PARTX command

In the Rhel or CentOS system 5|7:
Partprobe [Device]
Note: If the device name is omitted, the partition table is reread for all disk devices; It is strongly recommended that the specified disk device name be given directly;

In the Rhel or CentOS system 6|7:
partx-a [Device]
Kpartx-ax [Device]



FDISK partition
Fdisk-linux partition Table Operation Tool Software
Format:
FDISK device
Fdisk-l [Device:]

Options:
-L: Indicates the viewing meaning, if the device name is given, the partition table of the specified device is viewed; otherwise, the partition table of the device files for all disks is viewed;

Fdisk device:
To operate on a specified device:
Command (enter M for help): M
Command actions
D Delete a partition
L list known partition types
M Print this menu
n Add a new partition
P Print the partition table
Q Quit without saving changes
t change a partition ' s system ID
W Write table to disk and exit


The process of creating a partition in Fdisk interactive Menu mode:
N----p|e|l sector (cylinder), direct carriage return using default values--the end sector of the partition (cylinder), or you can specify the partition size directly using the + #UNIT

Parted command: Advanced partitioning tool with operation results in real time
PARTED-A Partition Manipulation Program
Format:
parted [options] [Device [command [Options ...] ...]]

Example:
~]# PARTED/DEV/SDA mkpart Logical 103GB 105GB
~]# PARTED/DEV/SDA RM 8

To add a SCSI interface disk to this server when powered on, to enable the device to be identified and create the appropriate device files, there are the following methods:
1. Restart the computer;
2.~]# echo "---" >/sys/class/scsi_host/host2/scan
Force the kernel to recognize the disk device of the new SCSI interface that is hot-plugged in the power-up state;

Storage Management for Linux

Related Article

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.