[root@kvm7 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 252:0 0 4G 0 disk ├─vda1 252:1 0 200M 0 part /boot ├─vda2 252:2 0 3.4G 0 part │ ├─vg_kvm7usb-swap 253:0 0 124M 0 lvm [SWAP] │ └─vg_kvm7usb-root 253:1 0 3.1G 0 lvm / ├─vda3 252:3 0 130M 0 part │ └─vg_kvm7home-vo 253:2 0 30M 0 lvm /home ├─vda4 252:4 0 1K 0 part └─vda5 252:5 0 10M 0 part [SWAP]
[root@kvm7 ~]# fdisk /dev/vda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/vda: 4294 MB, 4294967296 bytes, 8388608 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000cd485
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 411647 204800 83 Linux
/dev/vda2 411648 7579647 3584000 8e Linux LVM
/dev/vda3 7579648 7845887 133120 8e Linux LVM
/dev/vda4 7845888 8388607 271360 5 Extended
/dev/vda5 7847936 7868415 10240 82 Linux swap / Solaris
Command (m for help): n
All primary partitions are in use
Adding logical partition 6
First sector (7870464-8388607, default 7870464):
Using default value 7870464
Last sector, +sectors or +size{K,M,G} (7870464-8388607, default 8388607):
Using default value 8388607
Partition 6 of type Linux and of size 253 MiB is set
Command (m for help): p
Disk /dev/vda: 4294 MB, 4294967296 bytes, 8388608 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000cd485
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 411647 204800 83 Linux
/dev/vda2 411648 7579647 3584000 8e Linux LVM
/dev/vda3 7579648 7845887 133120 8e Linux LVM
/dev/vda4 7845888 8388607 271360 5 Extended
/dev/vda5 7847936 7868415 10240 82 Linux swap / Solaris
/dev/vda6 7870464 8388607 259072 83 Linux
Command (m for help): t
Partition number (1-6, default 6):
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): p
Disk /dev/vda: 4294 MB, 4294967296 bytes, 8388608 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000cd485
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 411647 204800 83 Linux
/dev/vda2 411648 7579647 3584000 8e Linux LVM
/dev/vda3 7579648 7845887 133120 8e Linux LVM
/dev/vda4 7845888 8388607 271360 5 Extended
/dev/vda5 7847936 7868415 10240 82 Linux swap / Solaris
/dev/vda6 7870464 8388607 259072 8e Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@kvm7 ~]# partprobe [root@kvm7 ~]# kpartx /dev/vda vda1 : 0 409600 /dev/vda 2048 vda2 : 0 7168000 /dev/vda 411648 vda3 : 0 266240 /dev/vda 7579648 vda4 : 0 2 /dev/vda 7845888 vda5 : 0 20480 /dev/vda 7847936 vda6 : 0 518144 /dev/vda 7870464
[root@kvm7 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 252:0 0 4G 0 disk ├─vda1 252:1 0 200M 0 part /boot ├─vda2 252:2 0 3.4G 0 part │ ├─vg_kvm7usb-swap 253:0 0 124M 0 lvm [SWAP] │ └─vg_kvm7usb-root 253:1 0 3.1G 0 lvm / ├─vda3 252:3 0 130M 0 part │ └─vg_kvm7home-vo 253:2 0 30M 0 lvm /home ├─vda4 252:4 0 1K 0 part ├─vda5 252:5 0 10M 0 part [SWAP] └─vda6 252:6 0 253M 0 part
[root@kvm7 ~]# pv [TAB}{TAB]
pvchange pvcreate pvmove pvresize pvscan
pvck pvdisplay pvremove pvs
[root@kvm7 ~]# pvscan PV /dev/vda2 VG vg_kvm7usb lvm2 [3.41 GiB / 172.00 MiB free] PV /dev/vda3 VG vg_kvm7home lvm2 [128.00 MiB / 98.00 MiB free] Total: 2 [3.54 GiB] / in use: 2 [3.54 GiB] / in no VG: 0 [0 ]
[root@kvm7 ~]# pvcreate /dev/vda6 Physical volume "/dev/vda6" successfully created
[root@kvm7 ~]# pvscan PV /dev/vda2 VG vg_kvm7usb lvm2 [3.41 GiB / 172.00 MiB free] PV /dev/vda3 VG vg_kvm7home lvm2 [128.00 MiB / 98.00 MiB free] PV /dev/vda6 lvm2 [253.00 MiB] Total: 3 [3.79 GiB] / in use: 2 [3.54 GiB] / in no VG: 1 [253.00 MiB]
[root@kvm7 ~]# vg [TAB][TAB] vgcfgbackup vgconvert vgextend vgmknodes vgs vgcfgrestore vgcreate vgimport vgreduce vgscan vgchange vgdisplay vgimportclone vgremove vgsplit vgck vgexport vgmerge vgrename
[root@kvm7 ~]# vgcreate --help
vgcreate: Create a volume group
vgcreate
[-A|--autobackup {y|n}]
[--addtag Tag]
[--alloc AllocationPolicy]
[-c|--clustered {y|n}]
[--commandprofile ProfileName]
[-d|--debug]
[-h|--help]
[-l|--maxlogicalvolumes MaxLogicalVolumes]
[--metadataprofile ProfileName]
[-M|--metadatatype 1|2]
[--[vg]metadatacopies #copies]
[-p|--maxphysicalvolumes MaxPhysicalVolumes]
[-s|--physicalextentsize PhysicalExtentSize[bBsSkKmMgGtTpPeE]]
[-t|--test]
[-v|--verbose]
[--version]
[-y|--yes]
[ PHYSICAL DEVICE OPTIONS ]
VolumeGroupName PhysicalDevicePath [PhysicalDevicePath...]
vg_mnt PE size 2M 的 VG。
[root@kvm7 ~]# vgcreate -s 2M vg_mnt /dev/vda6 Volume group "vg_mnt" successfully created
[root@kvm7 ~]# lv [TAB][TAB] lvchange lvextend lvmdiskscan lvmsar lvresize lvconvert lvm lvmdump lvreduce lvs lvcreate lvmchange lvmetad lvremove lvscan lvdisplay lvmconf lvmsadc lvrename
[root@kvm7 ~]# lvcreate --help
lvcreate: Create a logical volume
lvcreate
[-A|--autobackup {y|n}]
[-a|--activate [a|e|l]{y|n}]
[--addtag Tag]
[--alloc AllocationPolicy]
[-H|--cache
[--cachemode {writeback|writethrough}]
[--cachepool CachePoolLogicalVolume{Name|Path}]
[-c|--chunksize ChunkSize]
[-C|--contiguous {y|n}]
[--commandprofile ProfileName]
[-d|--debug]
[-h|-?|--help]
[--errorwhenfull {y|n}]
[--ignoremonitoring]
[--monitor {y|n}]
[-i|--stripes Stripes [-I|--stripesize StripeSize]]
[-k|--setactivationskip {y|n}]
[-K|--ignoreactivationskip]
{-l|--extents LogicalExtentsNumber[%{VG|PVS|FREE}] |
-L|--size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}
[-M|--persistent {y|n}] [-j|--major major] [--minor minor]
[--metadataprofile ProfileName]
[-m|--mirrors Mirrors [--nosync]
[{--mirrorlog {disk|core|mirrored}|--corelog}]]
[-n|--name LogicalVolumeName]
[--noudevsync]
[-p|--permission {r|rw}]
[--poolmetadatasize MetadataSize[bBsSkKmMgG]]
[--poolmetadataspare {y|n}]]
[--[raid]minrecoveryrate Rate]
[--[raid]maxrecoveryrate Rate]
[-r|--readahead {ReadAheadSectors|auto|none}]
[-R|--regionsize MirrorLogRegionSize]
[-T|--thin
[--discards {ignore|nopassdown|passdown}]
[--thinpool ThinPoolLogicalVolume{Name|Path}]
[-t|--test]
[--type VolumeType]
[-v|--verbose]
[-W|--wipesignatures {y|n}]
[-Z|--zero {y|n}]
[--version]
VolumeGroupName [PhysicalVolumePath...]
vg_mnt 上建立名為 pub,大小為 12 個 PE 的 LV。
[root@kvm7 ~]# lvcreate -l 12 -n pub vg_mnt Logical volume "pub" created.
vg_mnt。
[root@kvm7 ~]# vgs VG #PV #LV #SN Attr VSize VFree vg_kvm7home 1 1 0 wz--n- 128.00m 78.00m vg_kvm7usb 1 2 0 wz--n- 3.41g 172.00m vg_mnt 1 1 0 wz--n- 242.00m 218.00m
vg_mnt VG 內。
[root@kvm7 ~]# lvs LV VG Attr LSize vo vg_kvm7home -wi-ao---- 50.00m root vg_kvm7usb -wi-ao---- 3.12g swap vg_kvm7usb -wi-ao---- 124.00m pub vg_mnt -wi-a----- 24.00
vg_mnt-pub。
[root@kvm7 ~]# mkfs.vfat /dev/vg_mnt/pub mkfs.fat 3.0.20 (12 Jun 2013) unable to get drive geometry, using default 255/63