Shrink ext4 volume: Difference between revisions

From DWIKI
(Created page with "=Run fsck= e2fsck -f /dev/mapper/foo =Check minimum size= e2fsck -P /dev/mapper/foo gives you minimum size in blocks =Shrink filesystem= resize2fs -p /dev/mapper/foo 500G =Shrink volume= lresize -L 500T /dev/mapper/foo")
 
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:


=Check minimum size=
=Check minimum size=
  e2fsck -P /dev/mapper/foo
  resize2fs -P /dev/mapper/foo
gives you minimum size in blocks
gives you minimum size in 4k blocks


=Shrink filesystem=
=Shrink filesystem=
  resize2fs -p /dev/mapper/foo 500G
  resize2fs -p /dev/mapper/foo 500G


=Shrink volume=
=Shrink logical volume=
  lresize -L 500T /dev/mapper/foo
  lvresize -L 500T /dev/mapper/foo

Latest revision as of 12:27, 2 May 2024

Run fsck

e2fsck -f /dev/mapper/foo

Check minimum size

resize2fs -P /dev/mapper/foo

gives you minimum size in 4k blocks

Shrink filesystem

resize2fs -p /dev/mapper/foo 500G

Shrink logical volume

lvresize -L 500T /dev/mapper/foo