Linux Logical Volume creation

Source: Internet
Author: User

1. Create a PV physical volume
[Email protected] ~]# PVCREATE/DEV/SDA4/DEV/SDA5/DEV/SDA6/DEV/SDA7
Physical volume "/DEV/SDA4" successfully created
Physical volume "/DEV/SDA5" successfully created
Physical volume "/dev/sda6" successfully created
Physical volume "/DEV/SDA7" successfully created

2. Create a VG volume group
[Email protected] ~]# vgcreate VG_DATA/DEV/SDA4/DEV/SDA5/DEV/SDA6/DEV/SDA7
Volume Group "Vg_data" successfully created

3. View Volume Group information
[Email protected] ~]# Vgdisplay
-volume group-
VG Name Vg_data
System ID
Format lvm2
Metadata Areas 4
Metadata Sequence No 1
VG Access Read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 4
ACT PV 4
VG Size 3.00 TiB
PE Size 4.00 MiB
Total PE 787436
Alloc pe/size 0/0
Free Pe/size 787436/3.00 TiB
VG UUID ee9ybc-nwcj-zqea-o4vs-o2jk-3m9a-y8br8r

3. Create a logical volume according to the PE size
Lvcreate-l 787436-n Lv_data Vg_data

4. Formatting logical Volumes
Mkfs.ext4/dev/mapper/vg_data-lv_data

5. View the logical volume UUID
[Email protected] ~]# Blkid
/dev/sda2:uuid= "Fc5f54a3-f6c9-49bd-8dd2-a536de2b8370″type=" Ext4″
/dev/sda1:sec_type= "Msdos" uuid= "99fb-7635″type=" VFAT "
/dev/sda3:uuid= "3e5deca5-7b13-4630-83bd-97223a796e2d" type= "swap"
/dev/sda4:uuid= "Ikfv7k-nmgt-y99g-ac8i-uylb-e3f0-6ddvjl" type= "Lvm2_member"
/dev/sda5:uuid= "68t2lx-njss-texe-gjir-giqw-hbr1-meaweb" type= "Lvm2_member"
/dev/sda6:uuid= "0LH7H8-NPIS-J2ZW-VZR9-3E2G-0T7K-MAQDLM" type= "Lvm2_member"
/dev/sda7:uuid= "WLAFSQ-SZND-TD7S-B8OS-S7SN-PDP1-RXYVDX" type= "Lvm2_member"
/dev/mapper/vg_data-lv_data:uuid= "7d816a72-1797-4746-b48b-594ffa954fe4″type=" Ext4″

6. Create a mount Directory
Mkdir/u01

7. Write/etc/fstab
UUID=7D816A72-1797-4746-B48B-594FFA954FE4/U01 EXT4 Defaults 1 2

8. Mounting the file system
Mount-a

9. Verify the results
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda2 753G 2.5G 713G 1%/
Tmpfs 32G 72K 32G 1%/DEV/SHM
/DEV/SDA1 200M 260K 200M 1%/boot/efi
/dev/mapper/vg_data-lv_data
3.0T 200M 2.9T 1%/u01

10. Delete the logical volume (for new creation)
[Email protected] ~]# lvremove/dev/mapper/vg_data-lvol0
Do you really want to remove active logical volume LVOL0? [y/n]: Y
Logical volume "lvol0" successfully removed

Linux Logical Volume creation

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.