PV, VG, LV
Server disk partition Condition:
[Root@iz25ou6jy8jz ~]# Fdisk-l
disk/dev/xvda:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00060953
Device Boot Start End Blocks Id System
/DEV/XVDA1 * 1 2611 20970496 Linux
disk/dev/xvdb:322.1 GB, 322122547200 bytes
255 heads, Sectors/track, 39162 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00000000
[Root@iz25ou6jy8jz ~]#
[Root@iz25ou6jy8jz ~]# Df-h
FileSystem Size Used Avail use% mounted on
/DEV/XVDA1 20G 1.4G 18G 8%/
Tmpfs 1.9G 0 1.9G 0%/dev/shm
1. See if there are any LVM installed
# Rpm-qa|grep LVM
Lvm2-libs-2.02.100-8.el6.x86_64
Mesa-private-llvm-3.3-0.3.rc3.el6.x86_64
Lvm2-2.02.100-8.el6.x86_64
2. Partition the disk/DEV/XVDB and switch to an LVM disk
[Root@iz25ou6jy8jz ~]# Fdisk/dev/xvdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF Disklabel
Building a new DOS disklabel with disk identifier 0X035EF8D3.
Changes'll remain in memory only, until you decide to write them.
After this, the course, the previous content won ' t be recoverable.
Warning:invalid flag 0x0000 of partition table 4 is corrected by W (rite)
Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off "mode" (Command ' C ') and change display units to
Sectors (Command ' u ').
Command (M for help): n//n into partition mode
Command Action
E Extended
P primary partition (1-4)
P//Set as Primary partition
Partition number (1-4): 1//Set partition No.
The cylinder (1-39162, default 1):
Using Default value 1
Last cylinder, +cylinders or +size{k,m,g} (1-39162, default 39162):
Using Default Value 39162
Command (M for help): P//view current partition condition
disk/dev/xvdb:322.1 GB, 322122547200 bytes
255 heads, Sectors/track, 39162 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x035ef8d3
Device Boot Start End Blocks Id System
/DEV/XVDB1 1 39162 314568733+ Linux
Command (M for help): L//l View the corresponding file system code
0 Empty NEC DOS bayi minix/old Lin BF Solaris
1 FAT12 9 swap/so Linux C1 drdos/sec (fat-
2 Xenix root 3c partitionmagic c4 drdos/sec (fat-
3 Xenix usr Venix 80286 os/2 hidden c:c6 drdos/sec (fat-
4 FAT16 <32m PPC PReP Boot Linux Extended C7 Syrinx
5 Extended SFS NTFS volume set da non-fs data
6 FAT16 4d qnx4.x NTFS Volume set db cp/m/CTOs/.
7 Hpfs/ntfs 4e qnx4.x 2nd part Linux plaintext de Dell Utility
8 AIX 4f qnx4.x 3rd part 8e Linux LVM DF bootit
9 AIX bootable Ontrack DM Amoeba E1 DOS Access
A os/2 Boot manag wuyi ontrack DM6 Aux Amoeba BBT e3 DOS r/o
b W95 FAT32 cp/m 9f bsd/os e4 speedstor
C W95 FAT32 (LBA) Ontrack DM6 Aux A0 IBM Thinkpad hi EB BeOS FS
E W95 FAT16 (LBA) OnTrackDM6 a5 FreeBSD ee GPT
F W95 Ext ' d (LBA) ez-drive a6 OpenBSD ef EFI (fat-12/16/
OPUS Golden Bow A7 NeXTSTEP f0 linux/pa-risc b
One Hidden FAT12 5c Priam edisk A8 Darwin UFS F1 SpeedStor
Compaq diagnost speedstor A9 NetBSD f4 SpeedStor
Hidden FAT16 <3 The GNU HURD or Sys ab Darwin boot F2 DOS Secondary
Hidden FAT16 Novell Netware af hfs/hfs+ fb VMware VMFS
Hidden hpfs/ntf Novell Netware b7 BSDI FS FC VMware Vmkcore
The AST smartsleep disksecure mult b8 bsdi swap fd Linux RAID auto
1b Hidden W95 FAT3 pc/ix bb Boot Wizard hid Fe lanstep
1c Hidden W95 FAT3 Minix be Solaris boot ff BBT
1e Hidden W95 FAT1
Command (M for help): T//t into modify partition code mode
Selected partition 1
Hex code (type L to list codes): 8e//set to 8e, ie Linux LVM
Changed system type of partition 1 to 8e (Linux LVM)
Command (M for help): P//p Print out the modified result
disk/dev/xvdb:322.1 GB, 322122547200 bytes
255 heads, Sectors/track, 39162 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x035ef8d3
Device Boot Start End Blocks Id System
/DEV/XVDB1 1 39162 314568733+ 8e Linux LVM
Command (M for help): W//w Save changes and exit
The partition table has been altered!
Calling IOCTL () to re-read partition table.
Syncing disks.
[Root@iz25ou6jy8jz ~]#
[Root@iz25ou6jy8jz ~]# Fdisk-l
disk/dev/xvda:21.5 GB, 21474836480 bytes
255 heads, Sectors/track, 2610 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x00060953
Device Boot Start End Blocks Id System
/DEV/XVDA1 * 1 2611 20970496 Linux
disk/dev/xvdb:322.1 GB, 322122547200 bytes
255 heads, Sectors/track, 39162 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x035ef8d3
Device Boot Start End Blocks Id System
/DEV/XVDB1 1 39162 314568733+ 8e Linux LVM
[Root@iz25ou6jy8jz ~]#
Start creating
3. Create a PV physical volume
[Root@iz25ou6jy8jz ~]# PVCREATE/DEV/XVDB1
Physical volume "/DEV/XVDB1" successfully created
4. Create VG Volume group
[ROOT@IZ25OU6JY8JZ ~]# vgcreate volgroup/dev/xvdb1//volgroup for volume group names
Volume Group "Volgroup" successfully created
5. Activate Volume group
[Root@iz25ou6jy8jz ~]# vgchange-a y volgroup
Volume Group "Volgoup" not Found
Skipping volume group Volgoup
6. Create LV Logical Volume
[ROOT@IZ25OU6JY8JZ ~]# lvcreate-l 102400-n data volgroup
Logical volume "Data" created
102400 represents 100gb,data for logical volume names
Delete LV Logical Volume:
If you have created a file system and mounted it, first umount the directory that you have already mounted
# umount/data/
# Lvremove/dev/volgroup/data
Do your really want to remove active logical volume content? [y/n]: Y
Logical Volume "Data" successfully removed
Extend LV Volume:
[Root@iz25hxew2yfz ~]# lvextend-l +51200/dev/volgroup/data
Extending logical volume opt to 450.00 GiB
Logical volume opt successfully resized
Refresh Capacity:
[Root@iz25hxew2yfz ~]# Resize2fs/dev/volgroup/data
RESIZE2FS 1.41.12 (17-may-2010)
FileSystem at/dev/volgroup/data is mounted on/opt; On-line resizing required
Old Desc_blocks = New_desc_blocks = 29
Performing a on-line resize of/dev/volgroup/data to 117964800 (4k) blocks.
The filesystem on/dev/volgroup/data is now 117964800 blocks long.
7. Create a file system
[ROOT@IZ25OU6JY8JZ ~]# Mkfs.ext4/dev/volgroup/data//formatted as EXT4
MKE2FS 1.41.12 (17-may-2010)
FileSystem label=
OS Type:linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, stripe width=0 blocks
6553600 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the Super user
The Data block=0
Maximum filesystem blocks=4294967296
Block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Writing Inode Tables:done
Creating journal (32768 blocks): Done
Writing superblocks and filesystem accounting Information:done
This filesystem would be automatically checked every mounts or
180 days, whichever comes. Use Tune2fs-c or-i to override.
[Root@iz25ou6jy8jz ~]#
8. Mount
[Root@iz25ou6jy8jz ~]# Mkdir/data
[Root@iz25ou6jy8jz ~]# mount/dev/volgroup/data/data/
[Root@iz25ou6jy8jz ~]# Df-h
FileSystem Size Used Avail use% mounted on
/DEV/XVDA1 20G 1.4G 18G 8%/
Tmpfs 1.9G 0 1.9G 0%/dev/shm
/dev/mapper/volgroup-data
99G 188M 94G 1%/usr/local/data
[Root@iz25ou6jy8jz ~]#
9. Mount at Power-on, add the following at the end of/etc/fstab:
/dev/volgroup/data/data EXT4 Defaults 0 0
10.reboot reboot server test is successful.