Linux System Management (1)

Source: Internet
Author: User

Linux system management is mainly divided into: 1. Storage management; 2. package management; 3.sed, awk application ; 4. Process management; 5. network management; 6.Linux kernel management; 7.Linux system start-up process; 8. system installation; 9. Improve the use of shell scripts; Let's talk about Linux storage management.

The Linux storage management mainly has the disk controller, the bus, the disk interface, the disk controller generally has two kinds, the IDE as well as the SCSI, but the bus has mainly divides into the data bus, address bus, the control bus, of course, the bus does not work alone, generally is integrates in the motherboard the The disk interface can measure the IO capability of a disk, the type of disk interface: Now the main use of the IDE's parallel interface, from the earlier ATA, as well as the SCSI small Computer system interface, ATA's parallel data transfer to the serial interface, SAS serial interface, USB interface. The metric that measures the disk IO capability has another indicator in addition to the interface: IOPS (the number of read and write operations completed in a second). The IDE's mechanical disk, reading and writing rate average in the 50-100IOPS;SCSI mechanical disk, read and write rate averaged in 100-200iops, the read and write rate of the solid-state disk on the average in 400iops;sata mechanical disk, reading and writing rate averaged around 100IOPS, Solid-state disk at around 400IOPS, SAS mechanical disk, read and write rate averaged at around 200IOPS, solid-state disk read and write rate averaged around 800IOPS; pci-e solid-state disk reads about 400000-800000 IOPS, The ioPS write is about 50000-100000.

Today's common interface for disk controllers on X86 motherboards:

Ide:2 interface, each interface with a master disk and a slave disk, a total of four hard drives, if there is a CD-ROM, may be reduced to three disks plus an optical drive;

Sata:4-6 Interface:


Scsi:7 or 15 interfaces;


SAS: can provide at least 1023 interfaces, up to 16,384 interfaces;

Mechanical Disk:

Terms:

Track: A projection of the trajectory of a magnetic head on the surface of a disk;

Sector: Sector, 512Byte, now the sector is actually average; the smallest snap-in;

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: Head, each magnetic surface of each disc has a head for the data read and write operation;


Metrics for disk performance:

Spindle Speed: The number of revolutions per minute of disc rotation;

Average seek time: the elapsed time between the head from the start position to the specified position;

Cache:

/dev is used to store the mapped files of the hardware device, and the disk's device files are also stored here;

Device file: Is the access entry for the driver and device associated to the hardware device;


Device number:

Major: The main device number, which distinguishes the device types of different devices, and 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


The name must be saved in the/dev directory

IDE:HD[A-D]

scsi| sata| sas| usb:sd[a-z]+ Example: Sdaa


RedHat Enterprise Linux: Starting from RHEL6 the IDE interface disk is also named sd*, since then, all the disk devices are unified named sd[a-z]+;


How devices are referenced:

1. device file name Direct reference

The problem is that, for example, adding data to the SDD disk, the file name may no longer be the SDD after rebooting;

2. Label (Volume lable):

There is a problem: if the introduction of foreign devices, two devices if the volume label conflict, then only one device can start normally, the other device will not start normally;

3.UUID: Globally unique identifier, Universal unique IDentifier



Mknod command:

Mknod-make block or character special files

Format:

Mknod [OPTION] ... 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 the IO performance of the disk;

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. On a single device, multiple operating systems can be installed;


How to partition?

MBR: The entire disk space is less than 2TB capacity, the MBR partition format is recommended;

Mbr:master (main) boot record, master boot recording, started in 1982;

MBR is also a piece of data, the default is saved in the disk 0 track 0 sector;

is divided into three parts:

446bytes:boot Loader, boot loader program;

Windows:ntldr

linux:7.4 before Lilo,grub (default)

64bytes:partition table, partition table; each 16 bytes is a section that indicates the contents of a partition, so the default is up to four partitions;

1. A maximum of four 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 create a logical partition in the extended partition.

Logical partitions are numbered by default starting at 5, regardless of whether the previous four digits are occupied;


Note: The extended partition can have no, only one at most;

2BYTE:MBR end tag, 55AA;


GPT: GPT partition format is recommended for full disk space greater than 2TB capacity;

GUID Partition table, supports 128 primary partitions;


Common partitioning tools under Linux:

Fdisk

Used to create and manage MBR partitions, which can manage up to 15 partitions for the same disk;

Gdisk:gnu disk

Used to create and manage GPT partitions;


Note: If you use Fdisk or the Gdisk command to partition the remaining space of a disk that has already been mounted on a partition, 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, you can use the following methods:

1. Restart the computer;

2. Force the kernel to reread the partition table;

Partprobe command

PARTX command


In the Rhel or Cenos 5|7 version:

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 Cenos 6|7 version:

partx-a [Device]

KPARTX-AF [Device]



Fdisk Partitioning tool:

Fdisk-manipulate Disk partition Table


Format:

FDISK device

fdisk-l [device ...]


Options:

-L: Indicates the meaning of the view; If the device name is given, view the partition table for the specified device; otherwise view the partition table for all disk device files;


FDISK device

partition Management and operation for the specified device;

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:

----P|E|L indicates the starting sector (cylinder) of the partition, and the direct carriage return uses the default value--the end sector of the partition (cylinder), or the + #UNIT直接指定分区大小 can be used;



parted command: Advanced Partition tool, its operation result is effective 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 recognized by the kernel and create the appropriate device files, there are the following methods:

1. Restart your 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;


Linux System Management (1)

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.