lvm on linux
时间:2007-05-17 来源:jack_zheng
to create:
1. fdisk sdc, sdd, sde, set file type to 8e.
/dev/sdc1 1 62 497983+ 8e Linux LVM
/dev/sdc2 63 130 546210 8e Linux LVM
2. create physical volume root@vm:~# pvcreate /dev/sdc1 /dev/sdc2 /dev/sdd1 /dev/sde1
Physical volume "/dev/sdc1" successfully created
Physical volume "/dev/sdc2" successfully created
Physical volume "/dev/sdd1" successfully created
Physical volume "/dev/sde1" successfully created
root@vm:~# pvscan
No matching physical volumes found
3.create volume group. root@vm:~# vgcreate test /dev/sdc1 /dev/sdc2 /dev/sdd1 /dev/sde1
Volume group "test" successfully created
root@vm:~# pvdisplay
--- Physical volume ---
PV Name /dev/sdc1
VG Name test
PV Size 484.00 MB / not usable 0
Allocatable yes
PE Size (KByte) 4096
Total PE 121
Free PE 121
Allocated PE 0
PV UUID 7VkY0C-ENAP-aJgM-c3Ft-J7dK-SJBL-Mbf4hQ
... 4.create logical volume root@vm:~# lvcreate -L 50m -n test_lv1 test
Rounding up size to full physical extent 52.00 MB
Logical volume "test_lv1" created
root@vm:~# lvdisplay
--- Logical volume ---
LV Name /dev/test/test_lv1
VG Name test
LV UUID CsQqLG-Qsyp-TDUb-Fdv1-Hpgx-irRm-NjT8XT
LV Write Access read/write
LV Status available
# open 0
LV Size 52.00 MB
Current LE 13
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:4 5. make file system on lvm root@vm:~# mke2fs /dev/test/test_lv1
root@vm:~# mount /dev/test/test_lv1 /mnt/
6. management pvmove, ext2resize, lvextend... 7. remove root@vm:~# umount /dev/test/test_lv1
root@vm:~# lvremove /dev/test/test_lv1
Do you really want to remove active logical volume "test_lv1"? [y/n]: y
Logical volume "test_lv1" successfully removed
root@vm:~# vgremove test
Volume group "test" successfully removed root@vm:~# pvscan
PV /dev/sdc1 lvm2 [486.31 MB]
PV /dev/sdc2 lvm2 [533.41 MB]
PV /dev/sdd1 lvm2 [2.00 GB]
PV /dev/sde1 lvm2 [4.00 GB]
Total: 4 [6.99 GB] / in use: 0 [0 ] / in no VG: 4 [6.99 GB]
root@vm:~# lvdisplay
root@vm:~# vgdisplay
root@vm:~# pvdisplay
--- NEW Physical volume ---
PV Name /dev/sdc1
VG Name
PV Size 486.31 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 7VkY0C-ENAP-aJgM-c3Ft-J7dK-SJBL-Mbf4hQ
... 8. code 1) kernel. in linux/driver/md/, there are several parts. - md. for multi disk and volume management. - dm-. device mapper, it is the interface for system calls. - dm-crypt. for block encryption. 2) user space. - device-mapper.1.02.19 is the library to communicate with the kernel for lvm and other applications. - LVM2.2.02.25. 9. reference http://sources.redhat.com/dm/ http://www.chinaunix.net/jh/4/72921.html
/dev/sdc2 63 130 546210 8e Linux LVM
2. create physical volume root@vm:~# pvcreate /dev/sdc1 /dev/sdc2 /dev/sdd1 /dev/sde1
Physical volume "/dev/sdc1" successfully created
Physical volume "/dev/sdc2" successfully created
Physical volume "/dev/sdd1" successfully created
Physical volume "/dev/sde1" successfully created
root@vm:~# pvscan
No matching physical volumes found
3.create volume group. root@vm:~# vgcreate test /dev/sdc1 /dev/sdc2 /dev/sdd1 /dev/sde1
Volume group "test" successfully created
root@vm:~# pvdisplay
--- Physical volume ---
PV Name /dev/sdc1
VG Name test
PV Size 484.00 MB / not usable 0
Allocatable yes
PE Size (KByte) 4096
Total PE 121
Free PE 121
Allocated PE 0
PV UUID 7VkY0C-ENAP-aJgM-c3Ft-J7dK-SJBL-Mbf4hQ
... 4.create logical volume root@vm:~# lvcreate -L 50m -n test_lv1 test
Rounding up size to full physical extent 52.00 MB
Logical volume "test_lv1" created
root@vm:~# lvdisplay
--- Logical volume ---
LV Name /dev/test/test_lv1
VG Name test
LV UUID CsQqLG-Qsyp-TDUb-Fdv1-Hpgx-irRm-NjT8XT
LV Write Access read/write
LV Status available
# open 0
LV Size 52.00 MB
Current LE 13
Segments 1
Allocation inherit
Read ahead sectors 0
Block device 254:4 5. make file system on lvm root@vm:~# mke2fs /dev/test/test_lv1
root@vm:~# mount /dev/test/test_lv1 /mnt/
6. management pvmove, ext2resize, lvextend... 7. remove root@vm:~# umount /dev/test/test_lv1
root@vm:~# lvremove /dev/test/test_lv1
Do you really want to remove active logical volume "test_lv1"? [y/n]: y
Logical volume "test_lv1" successfully removed
root@vm:~# vgremove test
Volume group "test" successfully removed root@vm:~# pvscan
PV /dev/sdc1 lvm2 [486.31 MB]
PV /dev/sdc2 lvm2 [533.41 MB]
PV /dev/sdd1 lvm2 [2.00 GB]
PV /dev/sde1 lvm2 [4.00 GB]
Total: 4 [6.99 GB] / in use: 0 [0 ] / in no VG: 4 [6.99 GB]
root@vm:~# lvdisplay
root@vm:~# vgdisplay
root@vm:~# pvdisplay
--- NEW Physical volume ---
PV Name /dev/sdc1
VG Name
PV Size 486.31 MB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 7VkY0C-ENAP-aJgM-c3Ft-J7dK-SJBL-Mbf4hQ
... 8. code 1) kernel. in linux/driver/md/, there are several parts. - md. for multi disk and volume management. - dm-. device mapper, it is the interface for system calls. - dm-crypt. for block encryption. 2) user space. - device-mapper.1.02.19 is the library to communicate with the kernel for lvm and other applications. - LVM2.2.02.25. 9. reference http://sources.redhat.com/dm/ http://www.chinaunix.net/jh/4/72921.html
相关阅读 更多 +