Article Title: PartitionMagic-LVM in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Partition Magic can be said to be a Partition tool in windows. If you want to share a hard disk, you can do everything you need. What about Linux? Fdisk cannot properly resize the partition size. It is very troublesome to change the partition size once fdisk is used. Is there no way in Linux? None!
We also have the hardware disk partition management super weapon-LVM.
LVM (Logical Volume Manager) is a multi-disk management software in linux. It can treat multiple hard disks (PVs) as one hard disk group (VG ), on this hard disk group, you can perform any operations on the partition (LV. For example, if you have three hard disks PV1, PV2, PV3, and LVM will treat them as a hard disk (VG), you can create any partition (LV) on this VG ), you can also make any modifications to these partitions (similar to Partition Magic). All modifications take effect immediately without restarting. In addition, LVM can expand the VG without limit. That is to say, when your original hard disk is full and you want to add a new hard disk, you can add a new hard disk to your original VG through LVM, and allocate the added hard disk space to the partition you want to expand. Simply put, you can expand the partition size without changing the current partition structure.
Let's look at a simple example. After a long BT download, your hard disk is full. One of the media partitions stores media files. Now you need to add a new hard disk, this hard disk is mainly used to store media files.
Practices in Windows
Mount the hard disk, format the file, and separate a media partition to store the media file. In this way, you have two media partitions. If the partition is full, separate one... over time, you will have N partitions to store files of the same type, which is inconvenient to find. This is acceptable to individual users but fatal to servers.
Linux does not use LVM
Not much is found in Windows. The difference is that there are many more mount points.
Use LVM in Linux
Mount the hard disk, add the hard disk to the existing hard disk group (VG), and expand the media partition in the hard disk group. You still have only one media partition.
After talking about so many things, let's take a look. Note that most linux distributions now use LVM for default partition installation, and fedora 7 is no exception.
Most new users install fedora 7 all the way to Next and seldom perform manual partitioning. The default partition after installation is as follows:
--/Boot
-- VolGroup00
| -- LogVol00 (/)
| -- LogVol01 (Swap)
Fweewedsdfqweqw
In my Partition Table
/Dev/sda7 is/boot
/Dev/sda8 is VolGroup00 (VG)
If you install it by default, use
# Vgdisplay VolGroup00 view the disk group (VG) Information
# Lvdisplay VolGroup00 view partition (LV) Information
Because it is installed by default, my swap is 2 GB, which is too wasteful. Therefore, we plan to reduce it by a little. Because swap is in VolGroup00, It is very convenient to adjust the size,
The procedure is as follows:
Disable swap first
# Swapoff-v/dev/VolGroup00/LogVol01
Reduce 1G (if you want to add, you just need to change-to + on the premise that there is extra space)
# Lvm lvreduce/dev/VolGroup00/LogVol01-L-1G
Format the swap (you only need to re-format the swap when changing the swap. Other partitions do not need to be formatted. You can simply remove them)
# Mkswap/dev/VolGroup00/LogVol01
Re-open swap
# Swapon-va
It's so easy to change the swap.
Now that you have more than 1 GB of hard disk space, you can extend it to the root directory (/), which is also very simple, as shown below:
Increase 1 GB to LogVol00
# Lvextend-L + 1G/dev/LogVol00
In the previous step, only LogVol00 is added, and no file system is added.
# Resize2fs/dev/LogVol00
Added the root directory (/).
This is a small part of LVM applications.