1、LINUX中的LVM之增加容量与删除卷的方法详解LVLVMlvresizeVG VolGroup02/dev/sdc (8G)LV:rootlocalhost # vgdisplay- Volume group -VG Name VolGroup02System IDFormat lvm2Metadata Areas 1Metadata Sequence No 1VG Access read/writeVG Status resizableMAX LV 0Cur LV 0Open LV 0Max PV 0Cur PV 1Act PV 1VG Size 7.97 GiBPE Size 32.00
2、 MiBTotal PE 255Alloc PE / Size 0 / 0Free PE / Size 255 / 7.97 GiBVG UUID SETgjx-dobd-Uayt-AWgN-HKID-hsYe-tEotISrootlocalhost # lvcreate -L7.97 -n LogVol00 VolGroup02Rounding up size to full physical extent 32.00 MiBLogical volume LogVol00 createdrootlocalhost # mkfs -t ext4 /dev/VolGroup02/LogVol00
3、mke2fs 1.41.12 (17-May-2010)Filesystem label=OS type: LinuxBlock size=1024 (log=0)Fragment size=1024 (log=0)Stride=0 blocks, Stripe width=0 blocks8192 inodes, 32768 blocks1638 blocks (5.00%) reserved for the super userFirst data block=1Maximum filesystem blocks=335544324 block groups8192 blocks per
4、group, 8192 fragments per group2048 inodes per groupSuperblock backups stored on blocks:8193, 24577Writing inode tables: doneCreating journal (4096 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 23 mounts or180 days, wh
5、ichever comes first. Use tune2fs -c or -i to override.rootlocalhost # cd /rootlocalhost /# mkdir /u01rootlocalhost /# mount /dev/VolGroup02/LogVol00 /u01rootlocalhost /# vi /etc/fstab# /etc/fstab# Created by anaconda on Mon Aug 17 15:08:21 2015# Accessible filesystems, by reference, are maintained u
6、nder /dev/disk# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info#UUID=3440ad55-6486-45ed-876f-e942b08013bf / ext4 defaults 1 1UUID=d3abb655-db70-4c42-967d-57c421abfda0 /boot ext4 defaults 1 2UUID=660624ff-335d-42ca-b779-f130a80d9da8 /home ext4 defaults 1 2UUID=6f534bf0-e486-
7、4937-84ae-ed1221cf34f1 swap swap defaults 0 0/dev/VolGroup02/LogVol00 /u01 ext4 defaults 1 1tmpfs /dev/shm tmpfs defaults 0 0devpts /dev/pts devpts gid=5,mode=620 0 0sysfs /sys sysfs defaults 0 0proc /proc proc defaults 0 0/u01lvresize LV:rootlocalhost # lvscanACTIVE /dev/VolGroup02/LogVol00 32.00 M
8、iB inheritrootlocalhost # lvdisplay /dev/VolGroup02/LogVol00- Logical volume -LV Path /dev/VolGroup02/LogVol00LV Name LogVol00VG Name VolGroup02LV UUID OCHwx1-EL9P-6C5J-RNuz-2Xu5-4215-H3xt5sLV Write Access read/writeLV Creation host, time localhost.localdomain, 2015-09-01 10:50:10 +0800LV Status ava
9、ilable# open 1LV Size 32.00 MiBCurrent LE 1Segments 1Allocation inheritRead ahead sectors auto- currently set to 256Block device 253:0rootlocalhost # lvresize -L +7.89G /dev/VolGroup02/LogVol00Rounding size to boundary between physical extents: 7.91 GiBSize of logical volume VolGroup02/LogVol00 chan
10、ged from 32.00 MiB (1 extents) to 7.94 GiB (254 extents).Logical volume LogVol00 successfully resized:rootlocalhost # resize2fs -p /dev/VolGroup02/LogVol00resize2fs 1.41.12 (17-May-2010)Filesystem at /dev/VolGroup02/LogVol00 is mounted on /u01; on-line resizing requiredold desc_blocks = 1, new_desc_
11、blocks = 32Performing an on-line resize of /dev/VolGroup02/LogVol00 to 8323072 (1k) blocks.The filesystem on /dev/VolGroup02/LogVol00 is now 8323072 blocks long.rootlocalhost # df -hFilesystem Size Used Avail Use% Mounted on/dev/sda2 27G 6.0G 20G 24% /tmpfs 5.9G 0 5.9G 0% /dev/shm/dev/sda1 477M 32M
12、420M 8% /boot/dev/sdb1 99G 60M 94G 1% /home/dev/mapper/VolGroup02-LogVol007.7G 2.7M 7.3G 1% /u018G10G?:rootlocalhost u01# fdisk -lDisk /dev/sda: 42.9 GB, 42949672960 bytes64 heads, 32 sectors/track, 40960 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesSector size (logical/physical): 512 byt
13、es / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x000462cfDevice Boot Start End Blocks Id System/dev/sda1 * 2 501 512000 83 LinuxPartition 1 does not end on cylinder boundary./dev/sda2 502 28672 28847104 83 LinuxPartition 2 does not end on cylinder boundary./dev/sda3
14、28673 40960 12582912 82 Linux swap / SolarisPartition 3 does not end on cylinder boundary.Disk /dev/sdc: 8589 MB, 8589934592 bytes64 heads, 32 sectors/track, 8192 cylindersUnits = cylinders of 2048 * 512 = 1048576 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal):
15、512 bytes / 512 bytesDisk identifier: 0x98c391feDevice Boot Start End Blocks Id System/dev/sdc1 1 8192 8388592 83 LinuxDisk /dev/sdb: 107.4 GB, 107374182400 bytes255 heads, 63 sectors/track, 13054 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesSector size (logical/physical): 512 bytes / 51
16、2 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x0002488eDevice Boot Start End Blocks Id System/dev/sdb1 1 13055 104856576 83 LinuxDisk /dev/mapper/VolGroup02-LogVol00: 33 MB, 33554432 bytes255 heads, 63 sectors/track, 4 cylindersUnits = cylinders of 16065 * 512 = 8225280 b
17、ytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisk identifier: 0x00000000/dev/sdcLVMvgreduce, pvremovevgreduceLVMLVMpvremove: pvremoveLVMPV:rootlocalhost # fdisk -lDisk /dev/sda: 128.8 GB, 128849018880 bytes255 heads, 63 sectors/track, 1566
18、5 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDevice Boot Start End Blocks Id System/dev/sda1 * 1 13 104391 83 Linux/dev/sda2 14 10443 83778975 8e Linux LVM/dev/sda3 10444 15665 41945715 83 Linuxrootlocalhost # vgscanReading all physical volumes. This may take a while.Found volume group
19、 VolGroup00 using metadata type lvm2rootlocalhost # pvscanPV /dev/sda2 VG VolGroup00 lvm2 79.88 GB / 0 freePV /dev/sda3 VG VolGroup00 lvm2 40.00 GB / 40.00 GB freeTotal: 2 119.88 GB / in use: 2 119.88 GB / in no VG: 0 0 rootlocalhost # pvdisplay- Physical volume -PV Name /dev/sda2VG Name VolGroup00P
20、V Size 79.90 GB / not usable 23.41 MBAllocatable yes (but full)PE Size (KByte) 32768Total PE 2556Free PE 0Allocated PE 2556PV UUID YGtB2J-ZKJr-mV62-NluQ-2DGy-vuUT-cCc1lo- Physical volume -PV Name /dev/sda3VG Name VolGroup00PV Size 40.00 GB / not usable 2.61 MBAllocatable yesPE Size (KByte) 32768Tota
21、l PE 1280Free PE 1280Allocated PE 0PV UUID wsnv13-7j1H-SH8q-hl6k-HpNc-x4WU-gM7LzWrootlocalhost # lvscanACTIVE /dev/VolGroup00/LogVol00 77.91 GB inheritACTIVE /dev/VolGroup00/LogVol01 1.97 GB inheritrootlocalhost # lvsLV VG Attr LSize Origin Snap% Move Log Copy% ConvertLogVol00 VolGroup00 -wi-ao 77.9
22、1GLogVol01 VolGroup00 -wi-ao 1.97Gvgreduce-a;-removemissing:rootlocalhost # vgreduce VolGroup00 /dev/sda3Removed /dev/sda3 from volume group VolGroup00rootlocalhost #:rootlocalhost # pvscanPV /dev/sda2 VG VolGroup00 lvm2 79.88 GB / 0 freePV /dev/sda3 lvm2 40.00 GBTotal: 2 119.88 GB / in use: 1 79.88
23、 GB / in no VG: 1 40.00 GBrootlocalhost # pvsPV VG Fmt Attr PSize PFree/dev/sda2 VolGroup00 lvm2 a- 79.88G 0/dev/sda3 lvm2 a- 40.00G 40.00Grootlocalhost # pvremove /dev/sda3Labels on physical volume /dev/sda3 successfully wipedrootlocalhost # pvscanPV /dev/sda2 VG VolGroup00 lvm2 79.88 GB / 0 freeTotal: 1 79.88 GB / in use: 1 79.88 GB / in no VG: 0 0
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1