diff options
Diffstat (limited to 'sbin')
-rwxr-xr-x | sbin/itzks-diskless-re-partition-dlw | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sbin/itzks-diskless-re-partition-dlw b/sbin/itzks-diskless-re-partition-dlw index 89d4fd2..a34d0a0 100755 --- a/sbin/itzks-diskless-re-partition-dlw +++ b/sbin/itzks-diskless-re-partition-dlw @@ -21,7 +21,10 @@ # storage, first partition containing 16GB swap space, second # partition containing a scratch partition for local storage. +#!/bin/bash + DEV="$1" # pick your disk device +p="" if [ -z "${DEV}" ]; then echo "no device given" @@ -33,6 +36,10 @@ if [ ! -e ${DEV} ]; then exit 1 fi +if echo ${DEV} | grep -E "\/dev\/nvme.*"; then + p="p" +fi + wipefs -a ${DEV} # recommended if you want to swap partition table types # partitioning for 16G swapfs and rest as a scratch disk @@ -42,9 +49,9 @@ echo "label: gpt device: ${DEV} unit: sectors -${DEV}1 : size=${SWAP_SIZE}MiB, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F -${DEV}2 : type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, name=DLW_SCRATCH +${DEV}${p}1 : size=${SWAP_SIZE}MiB, type=0657FD6D-A4AB-43C4-84E5-0933C84B4F4F +${DEV}${p}2 : type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, name=DLW_SCRATCH " | sfdisk ${DEV} -mkswap ${DEV}1 -mkfs.ext4 -L DLW_SCRATCH ${DEV}
\ No newline at end of file +mkswap ${DEV}${p}1 +mkfs.ext4 -L DLW_SCRATCH ${DEV}${p}2 |