-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathgrow-disks
More file actions
executable file
·33 lines (22 loc) · 695 Bytes
/
grow-disks
File metadata and controls
executable file
·33 lines (22 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
set -e
echo "ALPINEBOX: Growing disks to use all available space"
ZPOOL_DEVS=`zpool list -P -L -H -v rpool|grep -v rpool|cut -f2|grep /`
#needs to be on, even tough its not going to be automatic.
zpool set autoexpand=on rpool
#important to prevent clashes with old labels in the unused space
zpool reguid rpool
for ZPOOL_DEV in $ZPOOL_DEVS; do
DISK=`lsblk -pno PKNAME $ZPOOL_DEV`
echo "ALPINEBOX: Repartitioning disk $DISK"
#repartition
sgdisk -d4 $DISK || true
sgdisk -n4:0:0 -t4:BF00 $DISK
#reload
partx -u $DISK
#grow
zpool online rpool -e $ZPOOL_DEV || true
done
echo "ALPINEBOX: Result:"
zfs list rpool
echo "ALPINEBOX: Done"