From 2e323d3f42ce901d8c98fee0b6a1ea9f85a75a80 Mon Sep 17 00:00:00 2001 From: vpeter4 Date: Wed, 23 Jan 2013 19:15:00 +0100 Subject: [PATCH] create_virtualimage: robustness creating image at least on Ubuntu --- packages/tools/syslinux/files/create_virtualimage | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/tools/syslinux/files/create_virtualimage b/packages/tools/syslinux/files/create_virtualimage index 34b39ab822..359a8263d6 100755 --- a/packages/tools/syslinux/files/create_virtualimage +++ b/packages/tools/syslinux/files/create_virtualimage @@ -185,6 +185,7 @@ echo "storage size: $STORAGE_SIZE MB" # ensure loopX not in use echo "" echo "next two errors can be ignored..." + sync umount "$LOOP" losetup -d "$LOOP" @@ -196,6 +197,7 @@ echo "storage size: $STORAGE_SIZE MB" # write a disklabel echo "" echo "creating new partition table: $DISK..." + sync losetup "$LOOP" "$DISK" parted -s "$LOOP" mklabel msdos @@ -239,6 +241,7 @@ echo "storage size: $STORAGE_SIZE MB" # create filesystem on partition1 echo "" + sync losetup -d "$LOOP" echo "creating filesystem on partition1..." OFFSET=$(( 64 * 512 )) @@ -247,6 +250,7 @@ echo "storage size: $STORAGE_SIZE MB" mke2fs -q -t ext4 -m 0 "$LOOP" tune2fs -U random -L "System" "$LOOP" sync + e2fsck -n "$LOOP" # mount partition echo "" @@ -292,6 +296,7 @@ EOF # create filesystem on partition2 echo "" + sync losetup -d "$LOOP" echo "creating filesystem on partition2..." OFFSET=$(( $STORAGE_PART_START * 512 )) @@ -299,8 +304,10 @@ EOF mke2fs -q -t ext4 -m 0 "$LOOP" tune2fs -U random -L "Storage" "$LOOP" sync + e2fsck -n "$LOOP" # detach loopX + sync losetup -d "$LOOP" # cleaning