Let's we have physical drive connected in slave of secondary IDE i.e /dev/hdd
#fdisk /dev/hdd (and create following partitions with id:8e)
Device Boot Start End Blocks Id System
/dev/hdd1 1 1000 503968+ 8e Linux LVM
/dev/hdd2 1001 2000 504000 8e Linux LVM
[root@localhost ~]# pvcreate /dev/hdd1 /dev/hdd2
Physical volume "/dev/hdd1" successfully created
Physical volume "/dev/hdd2" successfully created
[root@localhost ~]# pvdisplay [compare with the o/p of same command after creating f/s of LV]
"/dev/hdd1" is a new physical volume of "492.16 MB"
--- NEW Physical volume ---
PV Name /dev/hdd1
VG Name
PV Size 492.16 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID lanTX2-t6KC-MTID-Ag8V-un2g-R6a9-janMLC
"/dev/hdd2" is a new physical volume of "492.19 MB"
--- NEW Physical volume ---
PV Name /dev/hdd2
VG Name
PV Size 492.19 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID W29vIo-K2SN-07Zl-3Xn8-1pDX-hkxQ-P3gk2h
[root@localhost ~]# vgcreate testvg /dev/hdd1 /dev/hdd2
Volume group "testvg" successfully created
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name testvg
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 980.00 MB
PE Size 4.00 MB
Total PE 245
Alloc PE / Size 0 / 0
Free PE / Size 245 / 980.00 MB
VG UUID TbRxlH-zYl9-Y3zz-tsEH-1ASj-1uma-qhVLo8
[root@localhost ~]# lvcreate -L 124M -n testlv testvg [creating LV of size 124M with name testlv ]
Logical volume "testlv" created
[root@localhost ~]# lvdisplay /dev/testvg/testlv
--- Logical volume ---
LV Name /dev/testvg/testlv
VG Name testvg
LV UUID jFiX1B-SL0k-bZZ3-yHMb-zO4h-OySU-1Sw3a9
LV Write Access read/write
LV Status available
# open 0
LV Size 124.00 MB
Current LE 31
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@localhost ~]# mkfs -t ext3 /dev/testvg/testlv [ creating filesystem ]
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
31744 inodes, 126976 blocks
6348 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
16 block groups
8192 blocks per group, 8192 fragments per group
1984 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost lvmmntpt]# pvdisplay
--- Physical volume ---
PV Name /dev/hdd1
VG Name testvg
PV Size 492.16 MB / not usable 4.16 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 122
Free PE 122
Allocated PE 0
PV UUID lanTX2-t6KC-MTID-Ag8V-un2g-R6a9-janMLC
--- Physical volume ---
PV Name /dev/hdd2
VG Name testvg
PV Size 492.19 MB / not usable 0
Allocatable yes
PE Size (KByte) 4096
Total PE 123
Free PE 92
Allocated PE 31
PV UUID W29vIo-K2SN-07Zl-3Xn8-1pDX-hkxQ-P3gk2h
[root@localhost lvmmntpt]# vgdisplay
--- Volume group ---
VG Name testvg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 980.00 MB
PE Size 4.00 MB
Total PE 245
Alloc PE / Size 31 / 124.00 MB
Free PE / Size 214 / 856.00 MB
VG UUID TbRxlH-zYl9-Y3zz-tsEH-1ASj-1uma-qhVLo8
[root@localhost lvmmntpt]# lvdisplay /dev/testvg/testlv
--- Logical volume ---
LV Name /dev/testvg/testlv
VG Name testvg
LV UUID jFiX1B-SL0k-bZZ3-yHMb-zO4h-OySU-1Sw3a9
LV Write Access read/write
LV Status available
# open 1 [ here open is 1 because it's mounted]
LV Size 124.00 MB
Current LE 31
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@localhost ~]# vi /etc/fstab
…....
…....
/dev/testvg/testlv /lvmmntpt ext3 defaults 0 0
[root@localhost ~]# mount -a
[root@localhost ~]# cd /lvmmntpt/
[root@localhost lvmmntpt]# ls
lost+found
(It indicates successful mounting of newly created LV )
#fdisk /dev/hdd (and create following partitions with id:8e)
Device Boot Start End Blocks Id System
/dev/hdd1 1 1000 503968+ 8e Linux LVM
/dev/hdd2 1001 2000 504000 8e Linux LVM
[root@localhost ~]# pvcreate /dev/hdd1 /dev/hdd2
Physical volume "/dev/hdd1" successfully created
Physical volume "/dev/hdd2" successfully created
[root@localhost ~]# pvdisplay [compare with the o/p of same command after creating f/s of LV]
"/dev/hdd1" is a new physical volume of "492.16 MB"
--- NEW Physical volume ---
PV Name /dev/hdd1
VG Name
PV Size 492.16 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID lanTX2-t6KC-MTID-Ag8V-un2g-R6a9-janMLC
"/dev/hdd2" is a new physical volume of "492.19 MB"
--- NEW Physical volume ---
PV Name /dev/hdd2
VG Name
PV Size 492.19 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID W29vIo-K2SN-07Zl-3Xn8-1pDX-hkxQ-P3gk2h
[root@localhost ~]# vgcreate testvg /dev/hdd1 /dev/hdd2
Volume group "testvg" successfully created
[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name testvg
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 980.00 MB
PE Size 4.00 MB
Total PE 245
Alloc PE / Size 0 / 0
Free PE / Size 245 / 980.00 MB
VG UUID TbRxlH-zYl9-Y3zz-tsEH-1ASj-1uma-qhVLo8
[root@localhost ~]# lvcreate -L 124M -n testlv testvg [creating LV of size 124M with name testlv ]
Logical volume "testlv" created
[root@localhost ~]# lvdisplay /dev/testvg/testlv
--- Logical volume ---
LV Name /dev/testvg/testlv
VG Name testvg
LV UUID jFiX1B-SL0k-bZZ3-yHMb-zO4h-OySU-1Sw3a9
LV Write Access read/write
LV Status available
# open 0
LV Size 124.00 MB
Current LE 31
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@localhost ~]# mkfs -t ext3 /dev/testvg/testlv [ creating filesystem ]
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
31744 inodes, 126976 blocks
6348 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
16 block groups
8192 blocks per group, 8192 fragments per group
1984 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost lvmmntpt]# pvdisplay
--- Physical volume ---
PV Name /dev/hdd1
VG Name testvg
PV Size 492.16 MB / not usable 4.16 MB
Allocatable yes
PE Size (KByte) 4096
Total PE 122
Free PE 122
Allocated PE 0
PV UUID lanTX2-t6KC-MTID-Ag8V-un2g-R6a9-janMLC
--- Physical volume ---
PV Name /dev/hdd2
VG Name testvg
PV Size 492.19 MB / not usable 0
Allocatable yes
PE Size (KByte) 4096
Total PE 123
Free PE 92
Allocated PE 31
PV UUID W29vIo-K2SN-07Zl-3Xn8-1pDX-hkxQ-P3gk2h
[root@localhost lvmmntpt]# vgdisplay
--- Volume group ---
VG Name testvg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 980.00 MB
PE Size 4.00 MB
Total PE 245
Alloc PE / Size 31 / 124.00 MB
Free PE / Size 214 / 856.00 MB
VG UUID TbRxlH-zYl9-Y3zz-tsEH-1ASj-1uma-qhVLo8
[root@localhost lvmmntpt]# lvdisplay /dev/testvg/testlv
--- Logical volume ---
LV Name /dev/testvg/testlv
VG Name testvg
LV UUID jFiX1B-SL0k-bZZ3-yHMb-zO4h-OySU-1Sw3a9
LV Write Access read/write
LV Status available
# open 1 [ here open is 1 because it's mounted]
LV Size 124.00 MB
Current LE 31
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
[root@localhost ~]# vi /etc/fstab
…....
…....
/dev/testvg/testlv /lvmmntpt ext3 defaults 0 0
[root@localhost ~]# mount -a
[root@localhost ~]# cd /lvmmntpt/
[root@localhost lvmmntpt]# ls
lost+found
(It indicates successful mounting of newly created LV )
No comments:
Post a Comment