Merge pull request 'add btrfs image script' (#51) from martinallnet/Setup-Skripte:master into master

Reviewed-on: https://codeberg.org/Computertruhe/Setup-Skripte/pulls/51
Reviewed-by: B3rtl <b3rtl@noreply.codeberg.org>
Reviewed-by: Mac <mac@noreply.codeberg.org>
This commit is contained in:
B3rtl 2021-11-24 09:54:59 +01:00
commit 94262a819e
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
#!/bin/bash
IMG="$1"
DEV="$2"
if [ -z "$(command -v growpart)" ]; then
echo "growpart fehlt! Installiere cloud-guest-utils..."
sudo apt update
sudo apt install -y cloud-guest-utils
fi
if [ -z "$IMG" ] ; then
echo "Image-File angeben!"
exit 1
fi
if [ -z "$DEV" ] ; then
echo "HDD dev angeben! z. B. /dev/hdc"
exit 1
fi
echo "Warte 1 Sekunden vor dem löschen, abbrechen mit strg + c..."
sleep 1
echo "Achtung - vorbei, ich mache jetzt alles platt auf" "${DEV}"
sudo dd if="$IMG" of=$DEV bs=1M status=progress
sync
sudo growpart $DEV 3
sudo mount ${DEV}3 /mnt
sudo btrfs filesystem resize max /mnt
sudo umount /mnt
sync