Detect and resize root partition on QEMU (#414)

To increase the size of the partition you simply increase the size of the image using `truncate -s +200M /path/to/qemu.img` for example and then start QEMU.

More information:
https://github.com/postmarketOS/pmbootstrap/wiki/Common-Qemu-Notes#increase-partition-size
This commit is contained in:
drebrez 2017-08-19 00:39:32 +02:00 committed by Oliver Smith
parent 0136f832d0
commit b6ceef5138
2 changed files with 8 additions and 2 deletions

View file

@ -1,5 +1,5 @@
pkgname=postmarketos-mkinitfs pkgname=postmarketos-mkinitfs
pkgver=0.3.2 pkgver=0.3.3
pkgrel=3 pkgrel=3
pkgdesc="Tool to generate initramfs images for postmarketOS" pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://github.com/postmarketOS" url="https://github.com/postmarketOS"
@ -26,5 +26,5 @@ package() {
mkdir -p "$pkgdir/etc/postmarketos-mkinitfs/hooks/" mkdir -p "$pkgdir/etc/postmarketos-mkinitfs/hooks/"
} }
sha512sums="95e49eb5e7891d319543165290fb7279733e696db8c768d864d87ef36a20b04e1c4e8a1702a2927e7492ea2e9f3d4fdd83d9ea55811969689b9c2483fb3b44c4 init.sh.in sha512sums="95e49eb5e7891d319543165290fb7279733e696db8c768d864d87ef36a20b04e1c4e8a1702a2927e7492ea2e9f3d4fdd83d9ea55811969689b9c2483fb3b44c4 init.sh.in
64aa05363f79a0cf2319740753b8852f5252a5b35b23fecccb131cd77d306cd4c7fe287b2d58cea456f669ff99e20f53cf609703530abf6eda7c958a9e0811d2 init_functions.sh 2331fe9a89ba58348b41fbfdeb6f4daeff3f6ef161d1b7582c3e900baba377fa9411efa0b052ea5c2ae22f75bc48f6b8f38dafad0bd836a0319906e70482898c init_functions.sh
8b61ecc989f32ed49b34463d457e8506b267af9af5a9f42639354506c27e858517a9e954a62c808bbd114fd31c9628e263bb5ed4d7b754c65d4aea33675ca0ad mkinitfs.sh" 8b61ecc989f32ed49b34463d457e8506b267af9af5a9f42639354506c27e858517a9e954a62c808bbd114fd31c9628e263bb5ed4d7b754c65d4aea33675ca0ad mkinitfs.sh"

View file

@ -150,6 +150,12 @@ resize_root_partition() {
kpartx -afs "$partition_dev" kpartx -afs "$partition_dev"
fi fi
fi fi
# Detect and resize root partition on QEMU
if [ -z "${partition##"/dev/hda"*}" ]; then
echo "Resize root partition ($partition)"
parted -s /dev/hda resizepart 2 100%
partprobe
fi
} }
unlock_root_partition() { unlock_root_partition() {