-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathadd-disk
More file actions
executable file
·29 lines (20 loc) · 689 Bytes
/
add-disk
File metadata and controls
executable file
·29 lines (20 loc) · 689 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
#!/bin/sh
set -e
DISK=$1
if ! [ "$DISK" ]; then
echo "Usage: $0 <disk>"
echo "Will prepare disk and add it to your existing zpool mirror."
echo "Will WIPE existing DATA on specified disk!"
exit 1
fi
#sometimes the whole disk has an old label that confuses zfs after growing:
zpool labelclear -f $DISK &>/dev/null || true
cd install
./2-partition-disk.sh $DISK
./3-install-bootloader.sh $DISK
source config
#add to pool
ZPOOL_DEV=`zpool list -P -L -H -v $INSTALL_ZPOOL|grep -v $INSTALL_ZPOOL|grep ONLINE|cut -f2|grep /|tail -1`
zpool attach -f $INSTALL_ZPOOL $ZPOOL_DEV $INSTALL_ZPOOL_DEV
zpool status
echo "ALPINEBOX: Done, check rebuild status with zpool status"