Experiment
Take 10G from each of the two disks and make up the 20G volume group. Divides a 16G logical volume from a volume group, formats and mounts the logical volume to/mbox.
1. Add disk SDB and divide the disk into a 10G zone.
[Email protected] ~]# Fdisk/dev/sdb
Warning:dos-compatible mode is deprecated. It ' s strongly recommended to
Switch off the mode (command ' C ') and change display units to
Sectors (Command ' u ').
Command (M for help): P
Partition number (1-4): 1
First cylinder (1-10443, default 1):
Using Default value 1
Last cylinder, +cylinders or +size{k,m,g} (1-10443, default 10443): +10g
2. Change the partition format to LVM
Command (M for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (M for help): p {Enter P to view create disk partition information}
disk/dev/sdb:85.9 GB, 85899345920 bytes
255 heads, Sectors/track, 10443 cylinders
Units = Cylinders of 16065 * 8225280 bytes
Sector size (logical/physical): bytes/512 bytes
I/O size (minimum/optimal): bytes/512 bytes
Disk identifier:0x8ba5d75e
Device Boot Start End Blocks Id System
/DEV/SDB1 1 1306 10490413+ 8e Linux LVM
Command (M for help): W {confirm the creation of OK and enter W save
3. Add a second disk repeat above 1.2. Operation
4. Check if two LVM disks are OK
[Email protected] ~]# fdisk-l |grep LVM
/DEV/SDB1 1 1306 10490413+ 8e Linux LVM
/DEV/SDC1 1 1306 10490413+ 8e Linux LVM
5. Create PV
[Email protected] ~]# PVCREATE/DEV/SDB1/DEV/SDC1
Dev_is_mpath:failed to get device for 8:17
Physical volume "/DEV/SDB1" successfully created
Dev_is_mpath:failed to get device for 8:33
Physical volume "/DEV/SDC1" successfully created
6. View the creation of the PV
[Email protected] ~]# Pvscan
PV/DEV/SDB1 lvm2 [10.00 GiB]
PV/DEV/SDC1 lvm2 [10.00 GiB]
Total:2 [20.01 Gib]/in use:0 [0]/In no vg:2 [20.01 Gib]
7. View PV Details
[Email protected] ~]# Pvdisplay
"/DEV/SDB1" is a new physical volume of "10.00 GiB"
---NEW physical volume---
PV NAME/DEV/SDB1
VG Name
PV Size 10.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID ZEKDRX-NPLC-T3RC-OSP1-122X-LU1A-YWBJFS
"/DEV/SDC1" is a new physical volume of "10.00 GiB"
---NEW physical volume---
PV NAME/DEV/SDC1
VG Name
PV Size 10.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID BKBSSE-TUGX-KUGI-LIEW-LH5Y-PBZO-KEZVWT
8. Create VG [named DATA_VG]
[Email protected] ~]# vgcreate DATA_VG/DEV/SDB1/DEV/SDC1
Device DATA_VG not found (or ignored by filtering).
Dev_is_mpath:failed to get device for 8:17
Physical volume "/DEV/SDB1" successfully created
Physical volume "/DEV/SDC1" successfully created
[Email protected] ~]# Vgdisplay
---Volume Group---
VG Name DATA_VG
System ID
Format lvm2
Metadata Areas 2
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 2
ACT PV 2
VG Size 20.00 GiB
PE Size 4.00 MiB
Total PE 5120
Alloc pe/size 0/0
Free Pe/size 5120/20.00 GiB
VG UUID LGJTBL-E71I-ASCH-AX01-NBYB-T8YN-OJJ4Z1
9. Divide 16G from the created 20G VG [named DATA_LV]
[Email protected] ~]# lvcreate-l 16g-n data_lv DATA_VG
Logical volume "Data_lv" created
10.16GLV formatted as EXT3 format
[Email protected] ~]# MKFS.EXT3/DEV//DATA_VG/DATA_LV
MKE2FS 1.41.12 (17-may-2010)
File System label =
Operating system: Linux
Block size =4096 (log=2)
Chunked size =4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1048576 inodes, 4194304 blocks
209715 blocks (5.00%) reserved for the Super user
First block of data =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
Writing Inode table: complete
Creating Journal (32768 blocks): complete
Writing Superblocks and FileSystem accounting information: Complete
11. Create the/mbox and hang the/data_lv on to/mbox
[Email protected] ~]# Mkdir/mbox
[Email protected] ~]# Mount/dev/data_vg/data_lv/mbox
12. Enter Df-h to view mount information
[Email protected] ~]# df-h
Filesystem Size used Avail use% mounted on
/dev/sda2 97G 4.0G 88G 5%/
Tmpfs 932M 556K 931M 1%/DEV/SHM
/DEV/SDA1 194M 34M 151M 19%/boot
/dev/sda3 97G 188M 92G 1%/data
/dev/sr0 3.6G 3.6G 0 100%/media/rhel_6.5 x86_64 Disc 1
/dev/mapper/data_vg-data_lv 16G 173M 15G 2%/mbox
[Email protected] ~]#
This article is from the "12619984" blog, please be sure to keep this source http://12629984.blog.51cto.com/12619984/1901346
Linux System Management PV-VG-LV