Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
resize2fs DEVICE grows the file system to fill the device (also when mounted). With a size it can also shrink — only unmounted and after e2fsck -f. When you shrink, shrink the file system before the LV; when you grow, grow the LV first.
lvextend -r and lvreduce -r call it for you.
Zo schrijf je het
resize2fs [OPTION]... DEVICE [SIZE]Opties 10
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 10
$ als gewone gebruiker# als root (of met sudo)
1Grow after lvextend
lvextend -L +2G /dev/vgdata/lvweb resize2fs /dev/vgdata/lvwebOnline grow of a mounted ext4.
2Shrink to 3 GiB
umount /docs e2fsck -f /dev/vgfiles/lvdocs resize2fs /dev/vgfiles/lvdocs 3G lvreduce -L 3G /dev/vgfiles/lvdocs mount /docsThe order matters: file system first.
3How small can it get?
resize2fs -P /dev/vgfiles/lvdocs Estimated minimum size of the filesystem: 140326In blocks (usually 4 KiB).
4Shrink to the minimum
resize2fs -M /dev/vgfiles/lvdocsBefore copying to a smaller disk.
5Show progress
resize2fs -p /dev/vgdata/lvwebFor big file systems.
6Grow a partition-based ext4
growpart /dev/vdb 1; resize2fs /dev/vdb1After the disk was made bigger.
7Easier: let LVM do it
lvextend -r -L +1G /dev/vgdata/lvwebCalls resize2fs.
8Undo file for safety
resize2fs -z /root/resize.undo /dev/vgfiles/lvdocs 3GRestore with e2undo if something goes wrong.
9Check after resize
df -h /docsThe new size.
10Mounted shrink fails
resize2fs /dev/vgfiles/lvdocs 3G resize2fs: On-line shrinking not supportedUnmount first.
Niets past bij dit filter.
Exitcodes
0 | Done. |
1 | Error. |