Theoretical part:
A Disks and partitions:
1, disk partition representation: Common hard disks can be divided into primary partitions, extended partitions, and logical partitions. Typically, the primary partition is only 4, and the extended partition is considered a special primary partition type, and logical partitioning can be established in the extended partition. Primary partitions are typically used to install operating systems, and extended partitions are used to store file data.
2, the hard disk according to the data interface, roughly divided into ATA (IDE) and SATA as well as SCSI and SAS. Now used by the hard disk are SCSI hard disk, it is the advantage of the resource transfer of low CPU consumption, speed, support hot Plug and so on. So here we mainly introduce the structure of SCSI hard disk partition. The hard drive representation of the SCSI interface is: The first SCSI drive we can represent as "SDA" and the second SCSI drive as "SDB". And so on are "SDC", "SDD", "SDE", respectively.
3, on the basis of the hard disk we want to partition, Linux in the SCSI interface of the hard disk partition should be how to express. The first primary partition of the first disc should be "SDA1", the second primary partition of the first disk should be "Sda2", the first primary partition of the second disc should be "SDB1", and the second primary partition of the second hard disk should be "SDB2" and so on.
4, it should be noted here that there are 4 primary partitions, and the extended partition as a special primary partition, the logical partition is built on the extended partition. Therefore, the first logical partition is represented by "Sda5", followed by and so on.
5 partition is complete, next we should know the type of file system used in Linux. Here are two types of:?
1) EXT4 Type: 4th generation Extended File System (filesystem used by default for Linux systems) id:83?
2) Swap type: Swap file system (used to establish a swap partition for a Linux system, equivalent to virtual memory), the recommended size is 1.5-twice times of physical memory id:82
Two Master creating, mounting, and uninstalling file systems:
1, the process of creating a file system is the process of formatting partitions, Linux using the MKFS (create file System) command can format XFS, EXT4, fat and other different types of partitions, and the use of MKSWAP command can format swap swap partition.
2, in the Linux system, new to join a disk we need to partition, format, mount these three steps in order to use the disk. You can also uninstall if you do not want to use.
3, mount a partition, you must specify a directory as a mount point, the user through this directory to access the disk partition files and data.
3. When uninstalling the file system, you can uninstall the mount point or file device (select one of them). Because file devices can be mounted to multiple directories, it is recommended that you unmount the mount points.
Three Create a Management LVM logical volume (id:8e)
Linux system users when installing the operating system, how to accurately evaluate and allocate the capacity of each hard disk partition, if the original estimate is not accurate, once the system partition is not enough, you may have to back up, delete the relevant data, or even forced to re-plan the partition and reinstall the operating system to meet the needs of the application system. Then through the LVM logical volume management mechanism learning, mastering the dynamic adjustment of the Linux partition capacity method can solve this problem.
1. Is the concept of the LVM mechanism:
2. Let's look at some of the management commands for LVM, such as:
Four Understanding the RAID disk array principle:
1.RAID Simplified Chinese is called a standalone redundant disk array. Simply put, RAID is a combination of multiple independent physical hard disks in different ways to form a hard disk group (logical hard disk), providing a higher storage performance and storage capacity than a single hard drive data backup technology.
2. We can generally consider the composition of the disk group as a complete hard disk, the user can partition it, format, and so on. Because there are several ways to make a disk array, (as you can see by rank) Here's a recap: RAID0, RAID1, RAID5, RAID6, raid1+0
3. Advantages of the disk array: disaster-tolerant storage and fast access, efficient access rates, and reliability.
4. Disk at least two or more drives
5.Windows spanned volumes the equivalent of Linux's LVM logical volume management disk capacity: The sum of all disk capacity benefits: High scalability (movie post-production) Cons: Poor fault tolerance
6.Windows Striped Volume-----------Linux RAID0 disk Capacity: The sum of all disk capacity benefits: High read/write (website high access) Disadvantage: Fault tolerance combination condition: two or more disks of the same size
7.Windows mirrored volumes----------Linux RAID1 disk capacity: Half the sum of all disk capacities: high reliability (data sink Bank) Disadvantage: Half capacity, high cost combination condition: two or more disks of the same size
8.Windows RAID5----------Linux RAID5 disk Capacity: Sum of all disk capacities minus one disk capacity (n-1)/n Advantages: High Read and write, high reliability (data center) Disadvantage: Only bad piece of hard drive combination condition: Three pieces of the same size disk
9.Linux raid6 disk Capacity: Sum of all disk capacities minus two disk capacities (n-2)/n Advantages: Very high reliability (data center, cloud Platform) disadvantage: Write loss large combination of conditions: four or larger disk size
10.Linux raid1+0 Disk Capacity: Half of all disk capacity advantages: High Read and write, high reliability Disadvantage: A mirrored volume group is missing, the data will be lost combined condition: four or larger disks
Added: Raid is divided into two kinds of hard raid card and soft RAID card. The current interface types of RAID cards are IDE interface, SCSI interface, SATA interface, SAS interface.
Test section:
below to do the experiment from partitioning, formatting, mounting (or auto-mounting) to LVM Logical Volume management:
1. First we open the Linux system on the virtual machine and add a few hard drives inside and then enter the command INIT6 to restart the Linux system. For example:
2. Next we will create a partition for the newly added hard drive such as:
3. To this SDB the first primary partition has been created. Here are a few of our frequently used partition ID numbers (input l view): The FAT32 swap partition, the 83 primary partition, the 8e LVM logical partition, and the B-bit format.
4. The partition has been completed and can then be made into a logical volume, so it is necessary to convert the format, that is, to modify the ID as shown in:
5. Then the 2nd, 3rd, 4th Drive is also based on this method of partition configuration, here no longer one by one show;
In this experiment, we only partition SDB, SDC, and two disks into LVM format. We then made the two hard drives that were already configured into physical volumes. As shown in:
6. Do a physical volume the next step is to merge the physical volumes into volume groups. As shown in:
7. Now that the volume group has been built, the next step is to allocate the capacity needed to make the logical volume (LV). 2 logical volumes are made here. As shown in:
8. Next, format the disk. As shown in:
9. The third and final step is to mount the load. First we need to create a directory to mount. As shown in:
10. Use the command df-h to see if the logical volume is mounted successfully. (If the mount succeeds, the logical volume is available) as shown in:
11. Here's another point is that mount, which is temporarily mounted, will not be mounted when the system is restarted, so it is necessary to modify the path/etc/fstab the file if it is to be permanently active. The mount-a (equivalent to a flush mount) can be permanently enforced. such as:
to the end of this experiment!
Summary and supplement:
1. The structure of the hard disk is divided into physical structure and data structure, the physical structure is composed of disk and head, and the data structure is composed of sector, track and cylinder. Common interface types for hard drives are IDE, SATA, SCSI. The
2.fdisk command can partition a disk device. The
3.MKFS command can create EXT4, FAT32, and other types of file systems, and Mkswap commands can create swap file systems of swap types. The
4.mount command is used to mount a hard disk, disc, and other device files, and the Umount command uninstalls the specified device based on the device file or mount point.
- With the LVM dynamic disk scheme, you can expand your disk space flexibly.
Basic procedures for creating and using LVM scenarios: creating physical volumes → creating volume groups → creating logical volumes → format file system → Mount use.
6. The commonly used RAID levels are: Raid0,raid1,raid5,raid6,raid1+0.
The 7.RAID card currently has an IDE interface, SCSI interface, SATA interface, and SAS interface.
Learn how to manage Linux disks and partitions create and Mount file systems and create and manage LVM