Difference between revisions for lvm
Additions:
== reduce ==
# df -h /opt/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_xps-lv_optfs 69G 44G 23G 66% /opt
The goal is to reduce from 70G to 50G
==== umount ====
# umount /opt/
==== check filesystem ====
check a Linux ext2/ext3/ext4 file system
# e2fsck -ff /dev/mapper/vg_xps-lv_optfs
e2fsck 1.43.9 (8-Feb-2018)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
optfs: 117811/4587520 files (0.4% non-contiguous), 11609065/18350080
blocks
==== resize2fs filesystem ====
resize2fs - ext2/ext3/ext4 file system resizer
# resize2fs /dev/mapper/vg_xps-lv_optfs 50G
resize2fs 1.43.9 (8-Feb-2018)
Resizing the filesystem on /dev/mapper/vg_xps-lv_optfs to 13107200
(4k) blocks.
The filesystem on /dev/mapper/vg_xps-lv_optfs is now 13107200 (4k)
blocks long.
==== LVM reduce ====
# lvreduce -L -20G /dev/mapper/vg_xps-lv_optfs
WARNING: Reducing active logical volume to 50.00 GiB.
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce vg_xps/lv_optfs? [y/n]: y
Size of logical volume vg_xps/lv_optfs changed from 70.00 GiB (17920
extents) to 50.00 GiB (12800 extents).
Logical volume vg_xps/lv_optfs successfully resized.
==== verify ====
# mount /opt/
# df -h /opt/
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_xps-lv_optfs 50G 44G 3.6G 93% /opt
# mount /opt/Breach
# df -h /opt/Breach
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_xps-lv_Breach 7.0G 7.0G 15M 100% /opt/Breach
meta-data=/dev/mapper/vg_xps-lv_Breach isize=512 agcount=6,
agsize=327680 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1 spinodes=0
rmapbt=0
= reflink=0
data = bsize=4096 blocks=1826816,
imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks,
lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 1826816 to 7069696
# df -h /opt/Breach
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_xps-lv_Breach 27G 7.0G 20G 26% /opt/Breach