Partition problem of Linux hard disk and its solution

Source: Internet
Author: User
Tags file system advantage linux

The reason why I think of writing this is because I am tossing the Linux system in the process, there are many times fell into the trap of the hard disk partition experience. In the last few days, once again fell into the pit, tossing two geniuses from the pit to crawl out. After a lot of inquiry data, finally understand the hard disk partition some concepts. Record it below to alert the newcomer.

Talking about my own experience of falling out of the pit is all about the fierce collision between WinXP and Linux. Years ago, I began to install WinXP and Linux on a computer at the same time, as long as the order to comply with the first installation of WinXP and then install Linux, there will be no problems, Linux installation program will automatically identify multiple systems, installation is completed after the smooth start of multiple systems. One day, I felt that Linux alone was enough, so I installed Linux on my entire hard drive. Another day, I think still want to use WinXP, so I reinstall WinXP (don't say to me virtual machine, many years ago my computer has only 256M of memory, virtual machine does not move at all), the results found that WinXP installation program can not be able to partition the hard disk. This crater is caused by the LVM in Linux, WinXP can't recognize the LVM partition, and all the tools in the WinPE and DOS Toolbox in that era couldn't recognize the LVM, and then my knowledge of Linux was only partitioned when I installed the system, Do not know the Linux system also has fdisk, parted such tools, so toss for a long time to climb out of the pit. Now, years later, I fell into a hole again. I work with the computer is the WinXP system (celestial condition, you know), in order to do some chat, I installed a Ubuntu up, the two systems have been peaceful. Until one day, I put the Ubuntu system again to hang, and then reload, because in the partition accidentally chose the default "clear the entire disk and install Ubuntu", and then the hard drive is the entire lattice off, WinXP is not. I thought, that's a big deal, and I'm not going to be finished with a WinXP. But the problem is, no matter how I install it, the WinXP system is not going to start. It was later realized that the pit was caused by a GPT partition on the hard drive. So why did I let Ubuntu automatically partition it into a GPT partition? This also blame this HP's working machine is more exotic, it is supporting the legacy BIOS, also support EFI, when the original WinXP exists, it uses the MBR partition (MSDOS partition), so the installation of Ubuntu is the use of the MBR partition, and then to the Ubuntu automatic partition, It sees that the motherboard supports EFI and automatically drives the hard drive into a GPT partition. I also toss for a few days to understand this truth, finally, with the help of Ubuntu LiveCD's parted program, use a mklabel msdos command to change the hard drive from GPT partition to MBR partition, and then install WinXP and Ubuntu sequentially, To get out of the pit.

For those who have long managed large computer rooms and large storage capacity of the server's friends, for hard disk partitions, they must have done their homework. Not like me, until the problem is to learn the relevant knowledge. For the hard disk partition of this knowledge, I summarize the following (just summary, the specific content please yourself search Element):

1. The traditional BIOS only supports booting from the MBR partition's hard disk. The partition table for the MBR partition is stored in the first sector of the hard disk and only 64 bytes, so there can be up to four table entries. In other words, we can only divide the hard disk into 4 primary partitions, or divide it into less than 3 primary partitions plus one extended partition. Extended partitions can be divided into multiple logical partitions. The advantage of an MBR partition is that it's simple, everyone uses it, so everyone knows that many operating systems can boot from the MBR partition's hard disk. The disadvantage is that the MBR partition can not recognize the hard disk space larger than 2T, and can not have more than 2T partition;

2, GPT partitions of the hard disk can solve all the disadvantages of the above MBR partition, it does not have 4 primary partition restrictions, want to divide several primary partitions can be divided into several primary partitions, it can identify more than 2T of hard disk space, each partition size can also exceed 2T. But its disadvantage is that it requires operating system support. For example, only WinXP 64, win Vista, Win 7 and win 8, and the newer Linux distributions support GPT partitioned hard drives. Moreover, if there is no EFI support, the above system can only be GPT partitions of the hard disk as a data disk, can not be from the GPT partition hard disk boot;

3. To boot from the GPT partition's hard disk, the motherboard uses EFI, the hard disk uses GPT partitions, the operating system supports GPT and EFI these three conditions are indispensable. The newer 64-bit Linux systems and WIN8 systems are currently supported EFI, so they all need to be started from a GPT partition's hard disk. Now the computer motherboard has gradually abandoned the legacy BIOS, but only to support EFI. (Like my work machine, there will be fewer and less transition products.) At present, many of the motherboard pre-installed WIN8 notebook motherboards almost only support EFI. Therefore, it is imperative to learn about the relevant knowledge of GPT and EFI;

4, the above zoning strategy is fixed partition. Once the hard disk partition is complete, the size of the partition is not changed, and if you want to change the size of the partition, only repartition. And since there is no way to divide multiple hard drives into one area, the size of each partition is limited. So we need a dynamic partitioning of things. LVM is such an dongdong, it is called logical volume management. The mechanism for using LVM is this: first, the hard disk partition or the entire hard disk is marked as a physical volume (PV), then a volume group (VG) is created, one or more physical volumes are added to the volume group, and the volume group is finally partitioned, each of which is called a logical volume (LV). The advantage of LVM is that you can add the physical volume group size to the volume group at any time to dynamically resize the logical volume. This is particularly useful in the server, for example, there is a server originally has 100 users, its/home directory will have 100 users of the home directory, if they each allocated 20G space, will occupy a 2T of hard disk, if this time to 100 users how to do? If you use LVM to solve this problem, we can add a 3T hard drive, and then add this hard drive to the volume group to enlarge the volume group size, and then adjust the size of the logical volume where/home is located. LVM can be used with both MBR and GPT.

The above knowledge points are validated by the following automatic partitioning strategy for the Ubuntu 14.04 installation process. First, for computers that support only the legacy BIOS, the partitioning option for installing Ubuntu is as follows:

At this point, the option to start LVM is not selected. After installing the operating system, use the parted program to view the hard disk partitions, and view the/etc/fstab file to see which partition corresponds to which file system, as shown below:

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.