mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-26 20:18:52 +00:00
Fix filesystem resize by calling e2fsck -f
first
Previously when the block device was resized the partition table was also resized but the filesystem was not. For an increase from 64GiB to 128GiB the console showed: * Configuring host block device .../dev/vda1: clean, 62/4194304 files, 604445/16776960 blocks Resizing disk partition: Unpartitioned space /dev/vda: 64 GiB, 68719476736 bytes, 134217728 sectors resize2fs 1.43.3 (04-Sep-2016) Please run 'e2fsck -f /dev/vda1' first. /dev/vda1: clean, 62/4194304 files, 604445/16776960 blocks This patch makes `resize2fs` happy by running `e2fsck -f` beforehand as requested. Signed-off-by: David Scott <dave.scott@docker.com>
This commit is contained in:
parent
b2cae0e086
commit
79f8a87569
@ -7,7 +7,7 @@ depend()
|
|||||||
|
|
||||||
do_fsck()
|
do_fsck()
|
||||||
{
|
{
|
||||||
/sbin/e2fsck -p "$1"
|
/sbin/e2fsck -p $*
|
||||||
EXIT_CODE=$?
|
EXIT_CODE=$?
|
||||||
# exit code 1 is errors corrected
|
# exit code 1 is errors corrected
|
||||||
[ "${EXIT_CODE}" -eq 1 ] && EXIT_CODE=0
|
[ "${EXIT_CODE}" -eq 1 ] && EXIT_CODE=0
|
||||||
@ -44,6 +44,8 @@ do_fsck_extend_mount()
|
|||||||
blockdev --rereadpt $diskdev 2> /dev/null
|
blockdev --rereadpt $diskdev 2> /dev/null
|
||||||
mdev -s
|
mdev -s
|
||||||
|
|
||||||
|
# resize2fs fails unless we use -f here
|
||||||
|
do_fsck -f "$DATA" || return 1
|
||||||
resize2fs "$DATA"
|
resize2fs "$DATA"
|
||||||
|
|
||||||
do_fsck "$DATA" || return 1
|
do_fsck "$DATA" || return 1
|
||||||
|
Loading…
Reference in New Issue
Block a user