linux建立LV /檔案系統/擴大檔案系統 [root@r1c2b6 /]# lvcreate -L 100M -n xyy /dev/vg00 //建立lv Rounding up size to full physical extent 128.00 MB Logical volume "xyy" created[root@r1c2b6 /]# mkfs -t ext3 /dev/vg00/xyy //建立檔案系統mke2fs 1.39 (29-May-2006)Filesystem label=OS type: LinuxBlock size=1024 (log=0)Fragment size=1024 (log=0)32768 inodes, 131072 blocks6553 blocks (5.00%) reserved for the super userFirst data block=1Maximum filesystem blocks=6737100816 block groups8192 blocks per group, 8192 fragments per group2048 inodes per groupSuperblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729Writing inode tables: done Creating journal (4096 blocks): doneWriting superblocks and filesystem accounting information: doneThis filesystem will be automatically checked every 26 mounts or180 days, whichever comes first. Use tune2fs -c or -i to override.[root@r1c2b6 /]# mount /dev/vg00/xyy /xyy //掛載到檔案,根目錄下有個/xyy檔案[root@r1c2b6 /]# df -h檔案系統 容量 已用 可用 已用% 掛載點/dev/cciss/c0d0p1 3.9G 385M 3.3G 11% //dev/mapper/vg00-lvol7 39G 5.7G 32G 16% /home/dev/mapper/vg00-lvol6 9.7G 151M 9.1G 2% /opt/dev/mapper/vg00-lvol3 4.9G 139M 4.5G 3% /tmp/dev/mapper/vg00-lvol5 4.9G 228M 4.4G 5% /var/dev/mapper/vg00-lvol4 9.7G 2.5G 6.8G 27% /usrtmpfs 7.8G 0 7.8G 0% /dev/shm/dev/mapper/vg00-xyy 124M 5.6M 113M 5% /xyy[root@r1c2b6 /]# lvextend -L +200M /dev/vg00/xyy //擴充LV大小 Rounding up size to full physical extent 224.00 MB Extending logical volume xyy to 352.00 MB Logical volume xyy successfully resized[root@r1c2b6 /]# resize2fs /dev/vg00/xyy //重新為LV線上建立檔案系統resize2fs 1.39 (29-May-2006) Filesystem at /dev/vg00/xyy is mounted on /xyy; on-line resizing requiredPerforming an on-line resize of /dev/vg00/xyy to 360448 (1k) blocks.The filesystem on /dev/vg00/xyy is now 360448 blocks long.。[root@r1c2b6 /]# df -h檔案系統 容量 已用 可用 已用% 掛載點/dev/cciss/c0d0p1 3.9G 385M 3.3G 11% //dev/mapper/vg00-lvol7 39G 5.7G 32G 16% /home/dev/mapper/vg00-lvol6 9.7G 151M 9.1G 2% /opt/dev/mapper/vg00-lvol3 4.9G 139M 4.5G 3% /tmp/dev/mapper/vg00-lvol5 4.9G 228M 4.4G 5% /var/dev/mapper/vg00-lvol4 9.7G 2.5G 6.8G 27% /usrtmpfs 7.8G 0 7.8G 0% /dev/shm/dev/mapper/vg00-xyy 341M 6.1M 318M 2% /xyy[root@r1c2b6 /]# umount /xyy //取消lv掛載[root@r1c2b6 /]# lvremove /dev/vg00/xyy //刪除lvDo you really want to remove active logical volume xyy? [y/n]: y Logical volume "xyy" successfully removed[root@r1c2b6 /]# df -h檔案系統 容量 已用 可用 已用% 掛載點/dev/cciss/c0d0p1 3.9G 385M 3.3G 11% //dev/mapper/vg00-lvol7 39G 5.7G 32G 16% /home/dev/mapper/vg00-lvol6 9.7G 151M 9.1G 2% /opt/dev/mapper/vg00-lvol3 4.9G 139M 4.5G 3% /tmp/dev/mapper/vg00-lvol5 4.9G 228M 4.4G 5% /var/dev/mapper/vg00-lvol4 9.7G 2.5G 6.8G 27% /usrtmpfs 7.8G 0 7.8G 0% /dev/shm[root@r1c2b6 /]# vgdisplay --- Volume group --- VG Name vg00 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 14 VG Access read/write VG Status resizable MAX LV 0 Cur LV 6 Open LV 6 Max PV 0 Cur PV 1 Act PV 1 VG Size 275.34 GB PE Size 32.00 MB Total PE 8811 Alloc PE / Size 2432 / 76.00 GB Free PE / Size 6379 / 199.34 GB VG UUID h62KMe-WrQO-tJ4o-0AmN-zkUs-HHhk-5p7iiv [root@r1c2b6 /]# lvdisplay --- Logical volume --- LV Name /dev/vg00/lvol7 VG Name vg00 LV UUID T2jVvH-ndly-Kkvu-N2IR-YyNP-TrlI-OZlh15 LV Write Access read/write LV Status available # open 1 LV Size 40.00 GB Current LE 1280 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:0 --- Logical volume --- LV Name /dev/vg00/lvol6 VG Name vg00 LV UUID RJISQb-lVtd-9wiU-tUJv-2Z1t-5bKq-AxtQ0y LV Write Access read/write LV Status available # open 1 LV Size 10.00 GB Current LE 320 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:1 --- Logical volume --- LV Name /dev/vg00/lvol3 VG Name vg00 LV UUID 46XlPa-Gm1x-LWIE-7ngd-Alao-7NM9-72nTL6 LV Write Access read/write LV Status available # open 1 LV Size 5.00 GB Current LE 160 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:2 --- Logical volume --- LV Name /dev/vg00/lvol5 VG Name vg00 LV UUID aWbd1e-gjBd-lwDd-NoHG-IugQ-vddx-HEo4T6 LV Write Access read/write LV Status available # open 1 LV Size 5.00 GB Current LE 160 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:3 --- Logical volume --- LV Name /dev/vg00/lvol4 VG Name vg00 LV UUID CRZDnC-TqtI-nlgE-Jo8o-R6Rr-EfAu-1QWlsT LV Write Access read/write LV Status available # open 1 LV Size 10.00 GB Current LE 320 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:4 --- Logical volume --- LV Name /dev/vg00/lvol2 VG Name vg00 LV UUID CiwBMK-lkr8-YrS3-cJDL-3b4R-MZhN-cuLfsf LV Write Access read/write LV Status available # open 1 LV Size 6.00 GB Current LE 192 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:5 [root@r1c2b6 /]# lvdisplay -v /dev/vg00/lvol2 Using logical volume(s) on command line --- Logical volume --- LV Name /dev/vg00/lvol2 VG Name vg00 LV UUID CiwBMK-lkr8-YrS3-cJDL-3b4R-MZhN-cuLfsf LV Write Access read/write LV Status available # open 1 LV Size 6.00 GB Current LE 192 Segments 1 Allocation inherit Read ahead sectors auto - currently set to 256 Block device 253:5 [root@r1c2b6 /]# lvdisplay -v /dev/vg00/xyy //查看已經刪除 Using logical volume(s) on command line One or more specified logical volume(s) not found.[root@r1c2b6 /]#