Create an LV/file system or expand a file system in linux

Source: Internet
Author: User
Linux create LV/file system/resize file system [root @ r1c2b6/] # lvcreate-L100M-nxyy/dev/vg00 // create lvroundingupsizetofullphysicalextent128 .... create an LV/file system in linux or expand the file system [root @ r1c2b6/] # lvcreate-L 100 M-n xyy/dev/vg00 // Create a lv Rounding up size to full physical extent 128.00 MB Logical volume "xyy" created [root @ r1c2b6/] # mkfs-t ext3/dev/vg00/xyy // create a file system 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 = 1 Maximum filesystem blocks = 6737100816 block groups8192 blocks per group, 8192 fragments per group2048 inodes per groupSuperblock backups stored on blocks: 8193,245 77, 40961,573 45, 73729 Writing inode tables: done Creating journal (4096 blocks): doneWriting superblocks and filesys Tem 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 // mount to a file, there is a/xyy file in the root directory [root @ r1c2b6/] # df-H file system capacity in use available % mount point/dev/cciss/c0d0p1 3.9G 385 M 3.3G 11% // dev/mapper/vg00-lvol7 39G 5.7G 32G 16%/home/dev/mapper/vg00-lvol6 9.7G 151 M 9.1G 2%/opt/dev/ Mapper/vg00-lvol3 4.9G 139 M 4.5G 3%/tmp/dev/mapper/vg00-lvol5 4.9G 228 M 4.4G 5%/var/dev/mapper/vg00-lvol4 9.7G 2.5G 6.8G 27% G /usrtmpfs 7.8G 0 7.8G 0%/dev/shm/dev/mapper/vg00-xyy 124 M 5.6 M 113 M 5%/xyy [root @ r1c2b6/] # lvextend-L + 200 M /dev/vg00/xyy // expand the LV size Rounding up size to full physical extent 224.00 MB Extending logical volume xyy to 352.00 MB Logical volume xyy successfully resized [root @ r 1c2b6/] # resize2fs/dev/vg00/xyy // re-create the file system resize2fs 1.39 for LV online (29-May-2006) filesystem at/dev/vg00/xyy is mounted on/xyy; on-line resizing required‑ming an on-line resize of/dev/vg00/xyy to 360448 (1 k) blocks. the filesystem on/dev/vg00/xyy is now 360448 blocks long .. [Root @ r1c2b6/] # df-H file system capacity in use available % mount point/dev/cciss/c0d0p1 3.9G 385 M 3.3G 11% // dev/mapper/vg00-lvol7 39G 5.7G 32G 16%/home/dev/mapper/vg00-lvol6 9.7G 151 M 9.1G 2%/opt/dev/mapper/vg00-lvol3 4.9G 139 M 4.5G 3%/tmp/dev /mapper/vg00-lvol5 4.9G 228 M 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 341 M 6.1 M 318 M 2%/xyy [root @ r1c2b6/] # umoun T/xyy // cancel lv mounting [root @ r1c2b6/] # lvremove/dev/vg00/xyy // delete lvDo you really want to remove active logical volume xyy? [Y/n]: y Logical volume "xyy" successfully removed [root @ r1c2b6/] # df-H file system capacity in use available % mount point/dev/cciss/c0d0p1 3.9G 385 M 3.3G 11% // dev/mapper/vg00-lvol7 39G 5.7G 32G 16%/home/dev/mapper/vg00-lvol6 9.7G 151 M 9.1G 2%/opt/dev/mapper/vg00-lvol3 4.9G 139 M 4.5G 3%/tmp/dev/mapper/vg00-lvol5 4.9G 228 M 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 unzip 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 // check whether Using logical volume (s) on command line One or more specified logical volume (s) has been deleted) not found. [root @ r1c2b6/] #
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.