Use LVM on Ubuntu to easily adjust partitions and create snapshots

Source: Internet
Author: User
Tags gparted

Use LVM on Ubuntu to easily adjust partitions and create snapshots

The Ubuntu installer provides a check box to easily "use LVM. In its description, enabling logical volume management allows you to create snapshots and easily adjust the size of Hard Disk Partitions-here we will show you how to complete these operations.

LVM is a technology that is similar to RAID arrays or "buckets" on Windows. Although this technology is more useful on servers, it can also be used on a desktop PC.

 

Should you use LVM when installing Ubuntu?

The first question is, do you want to use LVM when installing Ubuntu? If yes, then Ubuntu makes all this very simple. You only need to click the mouse to complete it, but this option is not enabled by default. As the installer says, it allows you to adjust partitions, create snapshots, Merge multiple disks into one logical volume, and so on-everything can be done at system runtime. Unlike traditional partitions, you do not need to turn off your system, drive from Live CD or USB, and then adjust it when these partitions are not in use.

Frankly speaking, ordinary Ubuntu Desktop Users may not realize whether they are using LVM. However, if you want to do something more advanced in the future, LVM will be helpful. LVM may be more complex and may cause problems when you recover data in the future, especially when you have insufficient experience. There will be no significant performance loss here-LVM is fully implemented in the Linux kernel.

 

Logical volume Management

We have explained what LVM is. In summary, it provides an abstraction layer between your physical disk and the partition that is presented in your system. For example, your computer may have two hard drives, each of which is 1 TB in size. You must divide these disks into at least two zones, each of which is 1 TB.

LVM provides an abstraction layer on these partitions. Used to replace traditional partitions on disks. LVM treats these disks as independent "physical volumes" after you initialize them. Then, you can create logical volumes based on these physical volumes ". For example, you can combine the two 1 TB disks into a 2 TB partition, and your system will only see one 2 TB volume, LVM will handle all this in the background. A group of physical volumes and a group of logical volumes are called volume groups. A typical system only has one volume group.

This abstraction layer makes it easy to adjust partitions, combine multiple disk groups into a single volume, or even create "snapshots" for a file system running partitions, to do this, you do not need to detach the partition first.

Note: If you have not created a backup, merging multiple disks into one volume would be a bad idea. It is like RAID 0-if you combine two 1 TB volumes into a 2 TB volume, as long as one hard disk fails, you will lose important data on the volume. Therefore, if you want to follow this path, backup is important.

 

Graphical tool for managing LVM volumes

Generally, LVM is managed through Linux terminal commands. This works on Ubuntu, but there is a simpler Graphical Method for you to use. If you are a Linux User and are familiar with GParted or similar Partition Manager, forget it.-GParted does not support LVM disks at all.

However, you can use the disk tool that comes with Ubuntu. This tool is also called the GNOME disk tool or Palimpsest. Click the icon in dash to enable it. Search for "disk" and press Enter. Unlike GParted, this disk tool displays LVM partitions under "Other devices". Therefore, you can format these partitions as needed or adjust other options. This tool can also be used in Live CD or USB drives.

Unfortunately, this disk tool does not support most of the powerful features of LVM, and does not have options such as managing volume groups, expanding partitions, or creating snapshots. You can implement these operations through a terminal, but it is not necessary. Instead, you can open the Ubuntu Software Center, search for the keyword LVM, and install the logical volume management tool, you can run the sudo apt-get install system-config-lvm command in the terminal window to install it. After installation, you can open the logical volume management tool from dash.

This graphic configuration tool was developed by RedHat. It is a little outdated, but it is the only graphical method. You can use it to complete the above operations, leave the terminal commands behind.

For example, you want to add a new physical volume to the volume group. You can open the tool, select a new disk under the uninitialized entry, and click "initialize entry. Then, you can find the new physical volume under the unallocated volume, you can use the "add to existing volume group" button to add it to the "ubuntu-vg" volume group, which is the volume group created during Ubuntu installation.

The volume group view lists the overview of all your physical and logical volumes. Here, we have two physical partitions that span two independent hard drives. We have one swap partition and one root partition, which is the partition chart set by Ubuntu by default. Since we have added the second physical partition from another drive, there is a lot of unused space.

To expand a logical partition to a physical space, you can select it in the logical view, click Edit attribute, and modify the size to expand the partition. You can also narrow down the partition here.

Other options of system-config-lvm allow you to set snapshots and images. For traditional desktops, you may not need these features, but you can also use graphical processing here. Remember, you can also use terminal commands to complete this.

  • Use LVM to create elastic disk storage-Part 1
  • Expanding/downgrading LVM in Linux (Part 2)
  • Recording and restoring logical volume snapshots in LVM (part 3)
  • Set a streamlined resource allocation volume in LVM (part 4)
  • Use fragmented I/O to manage multiple LVM disks (Part 5)

Related Article

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.