New partition layout

This commit is contained in:
Jan Schneider 2018-01-23 23:47:01 +01:00
parent 4b88d54c1e
commit 0ce9aaa02b
1 changed files with 7 additions and 8 deletions

View File

@ -1,8 +1,7 @@
#!/bin/bash -e
LOOP_DEV=7
BOOT_SIZE=$((100*1024*1024))
GAP_SIZE=$((200*1024*1024)) # Reserved space for future use
BOOT_SIZE=$((250*1024*1024))
ROOT_SIZE=$((1000*1024*1024))
USR_LOCAL_SIZE=$((2*1024*1024))
@ -24,14 +23,14 @@ echo "image: ${image_file}"
echo "adjusted image: ${new_image_file}"
echo "*** Creating new image file and partitions ***"
dd if=/dev/zero of=$new_image_file bs=1M count=$((((${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}+${USR_LOCAL_SIZE})/1024/1024)+1))
dd if=/dev/zero of=$new_image_file bs=1M count=$((((${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}+${USR_LOCAL_SIZE})/1024/1024)+1))
parted --script $new_image_file \
mklabel msdos \
mkpart primary fat32 512B ${BOOT_SIZE}B \
set 1 boot on \
mkpart primary ext4 $((512+${BOOT_SIZE}+${GAP_SIZE}))B $((${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}))B \
mkpart primary ext4 $((512+${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}))B $((${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B \
mkpart primary ext4 $((512+${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B 100%
mkpart primary ext4 $((512+${BOOT_SIZE}))B $((${BOOT_SIZE}+${ROOT_SIZE}))B \
mkpart primary ext4 $((512+${BOOT_SIZE}+${ROOT_SIZE}))B $((${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B \
mkpart primary ext4 $((512+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B 100%
echo "*** Copying original partitons ***"
oIFS="$IFS"
@ -45,8 +44,8 @@ for line in $(parted $image_file unit B print | grep primary); do
echo $num - $start - $size
seek=0
[ "$num" = "1" ] && seek=$start
[ "$num" = "2" ] && seek=$(((512+${BOOT_SIZE}+${GAP_SIZE})/512))
[ "$num" = "3" ] && seek=$(((512+${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE})/512))
[ "$num" = "2" ] && seek=$(((512+${BOOT_SIZE})/512))
[ "$num" = "3" ] && seek=$(((512+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE})/512))
dd if=$image_file of=$new_image_file bs=512 skip=$start count=$size seek=$seek conv=notrunc
done