Virtual machines use LVM to manage new disks

Source: Internet
Author: User

1: Add two new disks to the virtual machine settings, 1 2g,1 5G (i mount two because I'm going to do a swap experiment, if I just mount a 5G with LVM)

2: Log in the system, use Fdisk-l to view the disk information (please restart)

3:LVM Management

A) Creating logical partitions

Fdisk/dev/sdc

#因为磁盘是空的, so I first created a primary partition to play with, size is 1G

N (Create a new partition)

P (primary partition)

Carriage return (mode start position)

+1G (primary partition size)

=========== Note that there is a selection on the top of the serial number, the default can be =================

Start creating an extended partition

N (new partition)

E (extended partition)

Enter (default start position)

Carriage return (default size, which is the remaining size of the disk)

============ Create complete =======================================

To start creating the logical partition, the logical partition is created on the extended partition that we just created, and after we have an extended partition, I enter n and then I automatically come out with this option.

N (new partition)

L (logical partition)

Enter (default start position)

+1G (1g size)

By default, the same is true, creating two logical partitions, my logical partitions are/DEV/SDC5,/DEV/SDC6 respectively 1g,2g

=========================================================

Input W Save

PARTPROBE/DEV/SDC (Synchronizing information)

===========================================================

b) Start LVM

Create PV

pvcreate/dev/sdc{5,6}

Create VG

Vgcreate vg_01/dev/sdc{5,6}

Once the creation is successful, start creating the LV

Lvcreate-n lvol0-l vg_01

Here small L is the number of blocks, a piece of my default is 4M, a specific piece of how much can be vgdisplay to view the pesize, this value can be changed

Well, this time lvol0 was created.

Formatting lvol0

Mkfs.ext4/dev/vg_01/lvol0

Then close at the mount point ABC.

Mount/dev/vg_01/lvol0/abc

If you need to mount the boot automatically, you need to write to/etc/fstab

/DEV/VG_01/LVOL0/ABC EXT4 Defaults 0 0

Reboot


Virtual machines use LVM to manage new disks

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.