Linux system Disk Management

Source: Internet
Author: User

The internal structure of the disk

Head assembly, drive structure of disk, disk slice (platter), spindle assembly, front-end control circuit

Head (head), the most expensive component in disk, is the most important part of the disk technology, using the contact structure, after power-up suspended in the high-speed rotating disk surface, divided into read-write one head (Read/write head) and separate head.

The read/write heads for all of the platters in the drive in a dirve is attached to one actuator arm assembly and move AC Ross the platter simultaneously. There is read/write heads per platter,one for each surface.

Track, when the disk is rotated and the head remains in one position, each head will draw a circular trajectory on the disk, which is the track.

Data is recorded. A track is a concentric ring around the spindle which contains information. A Trarck can hold a large amount of information. Track density decribes How tightly packed the track is on a platter.

Sector (Sector), each track on the disk is divided into arcs that are called sectors of the disk.

Every sectors store user data along with it own location Data:sector number, head number, or platter number and track Nu Mber. Bytes per sector.

Cylinder (Cylinder), a disk is usually composed of overlapping sets of platters, each of which is divided into data-equal tracks and numbered from the outer edge of "0", a cylinder with the same numbered track, called the disk's cylinder.

A cylinder is the set of identical tracks in both surfaces of each of the drives ' s platters. Often the location of drives is referred to by cylinder number rather than by track number.

Main parameters of the disk

Disk capacity (capacity), as the data memory of a computer system, the capacity is the most important parameter of the disk, the capacity of the disk in megabytes (MB) or gigabytes (GB) units.

Disk rpm (rotationl speed), which refers to the number of revolutions per minute that disk discs rotate, in rpm (revolutions per Minute).

Average seek time (Average seek times) refers to the time required to move the head to the track where the data is located, which is an important indicator of the mechanical performance of the disk.

Average incubation period (Average Latency), which is the time when the head is moved to the track where the data is located, waiting for the specified data sector to rotate below the head.

Average time to access (Average access time), which is the average number of times a read/write instruction is issued to the actual start of the first data read/write.

Data Transfer rate, which is the speed at which the disk reads and writes data, in megabytes per second (MB/s).

The basic function of disk buffers, also known as cache buffers, is to balance the internal and external data transfer rates, in order to reduce the host's wait time, the disk will read the data into the buffer, and so on all read or buffer filled, and then quickly sent to the host at the interface rate.

Disk interface  

The IDE (Integrated drive Electronics), or "Electronic integrated drives", is intended to refer to hard drives that integrate the "hard disk controller" with the "Disk body". The combination of the disk body and the controller reduces the number and length of the cable on the hard drive interface, the reliability of the data transfer is enhanced, and the hard drive is made easier, so the hard drive manufacturer does not need to worry about whether its hard drive is compatible with the controllers produced by other manufacturers. For users, hard drives are also more convenient to install. IDE this interface technology from the birth has been in continuous development, performance has been increasing, its low price, compatible with strong characteristics, for which other types of hard disk can not replace the status.

SCSI (Small computer system Interface), a standalone processor standard for system-level interfaces between computers and smart devices (hard disks, floppy drives, optical drives, printers, scanners, etc.).
FC (Fibre Channel), is the mesh channel, fiber interface, originally designed for the network system, with the storage system to the speed of demand, gradually applied to the hard disk system. Typically used to connect a SCSI raid (or some other commonly used raid type) to meet high-end work or server requirements for higher data rates.

SATA (Serial Advanced Technology Attachment), Ataz Chinese hard disk interface technology, SATA, is Serial ATA, a new type of hard disk interface completely different from parallel ATA, named because of the serial transmission of data. SATA 1.5gbit/s, SATA 3gbit/s, and SATA 6gbit/s are now available in three different sizes.

SAS (Serial attached SCSI), serial-attached SCSI, is a new generation of SCSI technology that is the same as the current popular Serial ATA (SATA) hard drives, with serial technology for higher transmission speeds and improved internal space by shortening the wiring. SAS is a new interface developed after the parallel SCSI interface. This interface is designed to improve the performance, availability, and scalability of storage systems and to provide compatibility with SATA drives.

SAS interface technology can be backwards compatible with SATA. In particular, the compatibility of the two is mainly embodied in the physical Layer and protocol layer compatibility. In the physical layer, the SAS interface and the SATA interface are fully compatible, SATA hard drives can be used directly in the SAS environment, from the interface standard, SATA is a sub-standard SAS, so the SAS controller can directly control the SATA drive, but SAS is not directly used in the SATA environment, Because the SATA controller does not control the SAS hard drive, at the protocol layer, the SAS consists of 3 types of protocols for data transmission based on the respective protocols connected to each device. Where the serial SCSI Protocol (SSP) is used to transport SCSI commands, SCSI Management Protocol (SMP) is used to maintain and manage connected devices, and SATA Channel Protocol (STP) is used for the transmission of data between SAS and SATA. So with these 3 protocols, SAS can be seamlessly combined with SATA and some SCSI devices.

Partitioning (Partition)

Low-level format: The realization of dividing the track sector and so on.

Advanced formatting: Create a file system.

Partitioning is the division of this disk into multiple logical constituent structures. Each logical component can create a separate file system, so that multiple independent file systems can be created on one disk.

MBR: Master boot Record (512byte 0,0,0) 0platter 0track,0sector

The first 446btyes bootloader program that can boot the operating system on a partition to start it up.

After 64bytes:per bytes: Represents a partition, thus the primary partition + extended partition <=4.

Last 2bytes,magic number: Marks whether the MBR is valid.

In the BIOS of the data ROM in the program code, check their health, after the boot, will be mapped to the lowest end of memory, the CPU began to execute this code, began to check their health, self-test no problem, the BIOS based on the boot sequence set in the BIOS, Go to the MBR (which may be a CD-ROM, USB device, hard disk device) for the boot device. The BIOS then maps the bootloader in the MBR to memory, biso the execution instructions to Cpu,bootloader, the BIOS exits, bootloader reads the partition table, finds the partition to find the operating system kernel, and the operating system kernel loads into memory, Boorloader the management to the operating system kernel.

Partition the disk:

The disk is partitioned by cylinder cylinder. Because when a file is stored, the data store is also stored on a cylinder in order to speed up file storage.

Since A platter is made up of concentric tracks, the outer trackes can hold more data than the inner ones beacause they ar E physically longer than ther inner trackes. However,in older disk drivers The outer tracks had the same number of sectors as the inner tracks, which means that the DA Ta density is low on the outer tracks. This is a inefficent use of the availables space.

The disk partition (platter with zone) can store data, but the stored data need logical boundaries, addressing the location of the function, to be able to classify, numbering, indexing. It is therefore necessary to create something called a filesystem on a partition. The file system is a management software that is stored in a location on the disk and not directly on the partition, but the stored data is on the partition. The file system can divide the storage space in a partition into two parts: one is metadata, the other is the data storage area, and the data storage zoning is divided into logical storage units, called Disk blocks block, logical concept.

    Meta Data area:

Specify a fixed area, block bitmap, blocks bitmap <---Storage catalog: The name of the file and the path of the store. Each file occupies one entry. Can point to disk block number, 2k

The inode bitmap for the catalog store corresponds to the entry store block one by one, and each entry is called the Inode (Index node) globally unique. Each inode is used to reference a file, storing inode numbers, corresponding file permissions, timestamps, owner, genus, extended attributes, size, stored block information, and no file name.

There is also a block bitmap bitmap, each block has a bit in the bitmap, only one, 1 is used, 0 is idle

File lookup Process

Root self-referencing:
A directory is also a disk block, divided into two parts, part of the inode number, part of the file name. Called directory entry, Dentry.

Scan the inode bitmap, find the free inode placeholder, locate the disk block corresponding to the directory, and find a directory entry dentry. Create an entry that is called Test.txt, and the idle inode number is placed to save.
Scan block Bitmap, find free disk block, 10k data at a time, will find 5 blocks.

introduce the concept of soft links and hard-link files:
Link file:
Soft links, also called Symbolic Links: two different paths directly to the same inode, which can be called a soft link

Symbolic links;
1, can be applied to the directory,
2, can cross file system
3, will not increase the number of connected files;
4, the size of the specified path contains the number of characters.

Hard links,
The Inode link, which stores the inode number and a file storage path, is the number of file store path characters, and the location of the file data store is found through the file storage path.
1, can only point to the file, can not be used in the directory;
2, can not cross the file system;
3, create a hard link will be how many times the file is linked;
Number of hard links: only the number of times less than 1 can be completely deleted, or just delete the file storage path, inode number and data still exist

ln [-S-V] SRC

Linux system Disk 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.