If you are using a common partition device, it is very likely that your disk uses several partitions. If you do not correctly set the partition size or your requirements change, you will find that you need to reset the partition size. To achieve this, you must be aware of your need to adjust the partition size and be familiar with the tools to complete this task. In many cases, the adjustment operation is generally smooth. However, many obstacles are caused by carelessness, and even those who have made sufficient preparations cannot be avoided.
This article first introduces some of the potential functions and restrictions of the adjustment tool, as well as some preparation work to be done between the start of the adjustment operation. Then we introduced the GParted Partition size adjustment tool, also known as Gnome Partition Editor ).
Note:For convenience, I useAdjust resizing)The word involves several operations, including increasing the partition size, reducing the partition size, and moving the partition. Sometimes, only one operation is feasible, and others are not feasible. Sometimes these operations are more risky than other operations. These differences are important and I have noticed this fact.
Basic work of partition Adjustment
When you start a partition tool, you should know what these programs can do and when to use them. You should also record the current configuration and back up data.
When can I adjust the partition size?
Let's review the differences between partitions and file systems.PartitionIs a container composed of adjacent sectors on the disk. partitions are defined by a simple data structure.File SystemOn the other hand, it is resident in the PartitionWithin. The file system allows computers to locate separate files, which are more complex in the score zone. In fact, to adjust the size of a partition, you usually need to adjust the file system it contains. For the sake of simplicity, the "Adjust partition" I used refers to "adjust the partition and the file system contained in it ".
Partition adjustment is at least risky in nature. The partition Adjustment Software must change the data structure of low-level partitions and file systems, and may need to move a large amount of data. Unreliable data on the disk, power failure, system crash, and other problems may cause catastrophic faults in the adjustment process. For these reasons, you should not easily adjust partitions, And you should back up data as long as possible.
In general, I do not recommend you adjust the partition unless there is a problem with the current settings or problems will occur soon. That is to say, the premise for you to consider adjusting the partition is that one or more partitions must be full, or you are sure to add a lot of data soon, which may cause overflow.
You must also remember to adjust the limits. For example, you cannot narrow down a file system, and you need to carefully plan the configuration of the primary partition and logical partition in the new layout. Sometimes such problems may become an obstacle for you to adjust your plan and force you to adopt another solution. For details, see section 2nd of this series.
Obtains the data used by the current partition.
In your partition adjustment plan, the first step is to obtain information about the current disk design method and which partition space is insufficient. A convenient way to obtain this type of information is to use GParted. GParted has a friendly GUI display. 1 shows the relative location between partitions and the space occupied by each partition. However, GParted does not always present complete information. Therefore, you need to use the text mode df, fdisk, or other utility to supplement the display.
Figure 1. GParted displays the disk usage Summary
Figure 1 shows a system with a limited/usr partition/dev/sdb5) and a large amount of space left in/home/dev/sdb7, if you want to add more software to your computer, this can cause problems. For the given partition layout, you can reduce the/home size and increase the/usr size. Note that figure 1 is obtained from an emergency boot disk, so the Mount Point Column cannot reflect the running system Mount Point .)
File System-specific functions
Linux supports several local file systems, and Dual Boot systems usually share disks with other systems. In general, ext2fs, ext3fs, ex4fs, ReiserFS, and Btrfs are the most flexible. These file systems can grow, shrink, or move, most of which can be implemented through GParted. Unfortunately, XFS and JFS cannot be reduced, but they can be increased and moved.
In common non-Linux File Systems, FAT and NTFS can grow, shrink, and move. HFS and HFS + used in macshortshes can be scaled down and moved, but cannot grow. The Disk Utility of OS X sometimes enables HFS + to increase partitions.
In GParted, you can selectView> File System SupportTo obtain the operations supported by file system tables and GParted. If you want to try this operation in your Linux system, you should realize that different versions support different ones. If you use an emergency boot disk, it may support different options than regular installation, which will be described later.
Plan A new partition Layout
With the current partition data and the information about the operations you can perform on the existing file system at hand, you can start planning your new layout. Consider the following important factors:
Prepare a backup
You may want to implement it immediately once you are ready to modify it. However, as a result of the risk of re-partitioning, as long as it can be implemented, you should back up key data. If the backup cannot be implemented, we recommend that you purchase a hard disk for backup. Even if you do not consider the danger of partition adjustment, sometimes hard disk failure or software problems will cause File System unavailability. Therefore, it is best to back up data.
It is most convenient to back up data to any storage medium. You can use tar to create a system backup. The file system will be compressed to a recordable DVD. However, most systems currently have very large user data and cannot store a single DVD. Therefore, you need to rely on other storage media to back up your data, such as an external hard disk.
Even if it cannot be completely backed up, you should back up the content in the/etc directory. This directory contains key system configurations. Therefore, if you need to reinstall the operating system, keep its copy to speed up the recovery process.