mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 13:46:49 +00:00
Merge pull request #1799 from vpeter4/virtual
create_virtualimage: robustness creating image at least on Ubuntu
This commit is contained in:
commit
eb2f8251c8
@ -185,6 +185,7 @@ echo "storage size: $STORAGE_SIZE MB"
|
|||||||
# ensure loopX not in use
|
# ensure loopX not in use
|
||||||
echo ""
|
echo ""
|
||||||
echo "next two errors can be ignored..."
|
echo "next two errors can be ignored..."
|
||||||
|
sync
|
||||||
umount "$LOOP"
|
umount "$LOOP"
|
||||||
losetup -d "$LOOP"
|
losetup -d "$LOOP"
|
||||||
|
|
||||||
@ -196,6 +197,7 @@ echo "storage size: $STORAGE_SIZE MB"
|
|||||||
# write a disklabel
|
# write a disklabel
|
||||||
echo ""
|
echo ""
|
||||||
echo "creating new partition table: $DISK..."
|
echo "creating new partition table: $DISK..."
|
||||||
|
sync
|
||||||
losetup "$LOOP" "$DISK"
|
losetup "$LOOP" "$DISK"
|
||||||
parted -s "$LOOP" mklabel msdos
|
parted -s "$LOOP" mklabel msdos
|
||||||
|
|
||||||
@ -239,6 +241,7 @@ echo "storage size: $STORAGE_SIZE MB"
|
|||||||
|
|
||||||
# create filesystem on partition1
|
# create filesystem on partition1
|
||||||
echo ""
|
echo ""
|
||||||
|
sync
|
||||||
losetup -d "$LOOP"
|
losetup -d "$LOOP"
|
||||||
echo "creating filesystem on partition1..."
|
echo "creating filesystem on partition1..."
|
||||||
OFFSET=$(( 64 * 512 ))
|
OFFSET=$(( 64 * 512 ))
|
||||||
@ -247,6 +250,7 @@ echo "storage size: $STORAGE_SIZE MB"
|
|||||||
mke2fs -q -t ext4 -m 0 "$LOOP"
|
mke2fs -q -t ext4 -m 0 "$LOOP"
|
||||||
tune2fs -U random -L "System" "$LOOP"
|
tune2fs -U random -L "System" "$LOOP"
|
||||||
sync
|
sync
|
||||||
|
e2fsck -n "$LOOP"
|
||||||
|
|
||||||
# mount partition
|
# mount partition
|
||||||
echo ""
|
echo ""
|
||||||
@ -292,6 +296,7 @@ EOF
|
|||||||
|
|
||||||
# create filesystem on partition2
|
# create filesystem on partition2
|
||||||
echo ""
|
echo ""
|
||||||
|
sync
|
||||||
losetup -d "$LOOP"
|
losetup -d "$LOOP"
|
||||||
echo "creating filesystem on partition2..."
|
echo "creating filesystem on partition2..."
|
||||||
OFFSET=$(( $STORAGE_PART_START * 512 ))
|
OFFSET=$(( $STORAGE_PART_START * 512 ))
|
||||||
@ -299,8 +304,10 @@ EOF
|
|||||||
mke2fs -q -t ext4 -m 0 "$LOOP"
|
mke2fs -q -t ext4 -m 0 "$LOOP"
|
||||||
tune2fs -U random -L "Storage" "$LOOP"
|
tune2fs -U random -L "Storage" "$LOOP"
|
||||||
sync
|
sync
|
||||||
|
e2fsck -n "$LOOP"
|
||||||
|
|
||||||
# detach loopX
|
# detach loopX
|
||||||
|
sync
|
||||||
losetup -d "$LOOP"
|
losetup -d "$LOOP"
|
||||||
|
|
||||||
# cleaning
|
# cleaning
|
||||||
|
Loading…
x
Reference in New Issue
Block a user