diff --git a/init/setup-rw.sh b/init/setup-rw.sh index 5a84f9ec..9d8c5b9e 100755 --- a/init/setup-rw.sh +++ b/init/setup-rw.sh @@ -1,9 +1,19 @@ #!/bin/sh +dev=/dev/xvdb + if mountpoint -q /rw ; then # This means /rw is mounted now. echo "Checking /rw" >&2 + echo "Private device size management: enlarging $dev" >&2 + if content=$(resize2fs "$dev" 2>&1) ; then + echo "Private device size management: resize2fs of $dev succeeded" >&2 + else + echo "Private device size management: resize2fs $dev failed:" >&2 + echo "$content" >&2 + fi + if ! [ -d /rw/config ] ; then echo "Virgin boot of the VM: populating /rw/config" >&2 diff --git a/init/setup-rwdev.sh b/init/setup-rwdev.sh index bf12853d..4c51caf5 100755 --- a/init/setup-rwdev.sh +++ b/init/setup-rwdev.sh @@ -26,27 +26,11 @@ if [ -e "$dev" ] ; then fi fi - echo "Private device size management: enlarging $dev" >&2 - if content=$(resize2fs "$dev" 2>&1) ; then - echo "Private device size management: resize2fs of $dev succeeded" >&2 + echo "Private device management: checking $dev" >&2 + if content=$(fsck.ext4 -p "$dev" 2>&1) ; then + echo "Private device management: fsck.ext4 of $dev succeeded" >&2 else - echo "Private device size management: resize2fs $dev failed:" >&2 + echo "Private device management: fsck.ext4 $dev failed:" >&2 echo "$content" >&2 - echo "Private device size management: attempting to mark $dev clean" >&2 - if content=$(fsck.ext4 -fp "$dev" 2>&1) ; then - echo "Private device size management: $dev marked clean, enlarging it again" >&2 - if content=$(resize2fs "$dev" 2>&1) ; then - echo "Private device size management: resize2fs of $dev succeeded" >&2 - else - echo "Private device size management: resize2fs of $dev failed even after marking file system clean:" >&2 - echo "$content" >&2 - echo "Private device size management: expect serious trouble ahead" >&2 - fi - else - echo "Private device size management: $dev could not be marked clean:" >&2 - echo "$content" >&2 - echo "Private device size management: expect serious trouble ahead" >&2 - fi fi - fi