⑴当扩展完物理边界后你会发现,挂载中的逻辑卷还是本身的大小。
⑵[rootstation ~]# df -hT
⑶Filesystem Type Size Used Avail Use% Mounted on
⑷/dev/mapper/vg-root
⑸ext G M G % /
⑹tmpfs tmpfs M M % /dev/shm
⑺/dev/sda ext M M M % /boot
⑻/dev/mapper/vg-usr
⑼ext .G .G .G % /usr
⑽/dev/mapper/vg-var
⑾ext G M G % /var
⑿/dev/mapper/myvg-test
⒀ext .G M .G % /mnt
⒁扩展逻辑边界,逻辑边界指的是挂载后,在使用中的逻辑卷也直接识别了。
⒂[rootstation ~]# resizefs /dev/myvg/test
⒃resizefs .. (-May-
⒄Filesystem at /dev/myvg/test is mounted on /mnt; on-line resizing required
⒅old desc_blocks = , new_desc_blocks =
⒆Performing an on-line resize of /dev/myvg/test to (k blocks.
⒇The filesystem on /dev/myvg/test is now blocks long.
⒈[rootstation ~]# df -hT
⒉Filesystem Type Size Used Avail Use% Mounted on
⒊/dev/mapper/vg-root
⒋ext G M G % /
⒌tmpfs tmpfs M M % /dev/shm
⒍/dev/sda ext M M M % /boot
⒎/dev/mapper/vg-usr
⒏ext .G .G .G % /usr
⒐/dev/mapper/vg-var
⒑ext G M G % /var
⒒/dev/mapper/myvg-test
⒓ext G M G % /mnt
⒔上述就是扩展逻辑卷部分。
⒕实例演示:缩小逻辑卷。首先为了测试我去原先挂载的录下创建一些文件,测试一下缩小后会不会导致文件消失。
⒖缩小逻辑卷的步骤如下:
⒗先卸载之前的挂载,并执行强制检测。
⒘[rootstation ~]# umount /mnt/
⒙[rootstation ~]# efsck -f /dev/myvg/test
⒚efsck .. (-May-
⒛Pass : Checking inodes, blocks, and sizes
①Pass : Checking directory structure
②Pass : Checking directory connectivity
③Pass : Checking reference counts
④Pass : Checking group summary information
⑤/dev/myvg/test: / files (.% non-contiguous, / blocks
⑥缩减逻辑边界。
⑦[rootstation ~]# resizefs /dev/myvg/test G
⑧resizefs .. (-May-
⑨Resizing the filesystem on /dev/myvg/test to (k blocks.
⑩The filesystem on /dev/myvg/test is now blocks long.
Ⅰ缩减物理边界。
Ⅱ[rootstation ~]# lvreduce -L G /dev/myvg/test
ⅢWARNING: Reducing active logical volume to . GiB
ⅣTHIS MAY DESTROY YOUR DATA (filesystem etc.
ⅤDo you really want to reduce test? [y/n]: y
ⅥReducing logical volume test to . GiB
ⅦLogical volume test suessfully resized
Ⅷ[rootstation ~]# lvdisplay /dev/myvg/test
Ⅸ--- Logical volume ---
ⅩLV Path /dev/myvg/test
㈠LV Name test
㈡VG Name myvg
㈢LV UUID wYYUF-fo-jzu-mtTL-p-qvfC-QfFy
㈣LV Write Aess read/write
㈤LV Creation host, time station.magelinux., -- :: +
㈥LV Status available
㈦LV Size . GiB-》这里又变成了G。
㈧Current LE
㈨Segments
㈩Allocation inherit
Read ahead sectors auto
- currently set to
Block device :
挂载继续使用并且查看文件是否存在。
[rootstation ~]# mount /dev/myvg/test /mnt/
[rootstation ~]# cd /mnt/
[rootstation mnt]# ls
ap be lost+found--》查看还是存在。未丢失。
[rootstation mnt]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/vg-root
ext G M G % /
tmpfs tmpfs M M % /dev/shm
/dev/sda ext M M M % /boot
/dev/mapper/vg-usr
ext .G .G .G % /usr
/dev/mapper/vg-var
ext G M G % /var
/dev/mapper/myvg-test
ext .G M .G % /mnt