diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-01-27 16:46:43 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-01-27 16:46:43 +0100 |
commit | 18722a4e156c1402e7366f2b0d7e58b4c69474d4 (patch) | |
tree | 5c36758ff0f7bceff7fe73f8da8cdd05096d983b /sbin/itzks-diskless-re-partition-dlw | |
parent | 0328a52303c9a9d50ed4b866c45a76161c91d5b3 (diff) | |
download | itzks-systems-18722a4e156c1402e7366f2b0d7e58b4c69474d4.tar.gz itzks-systems-18722a4e156c1402e7366f2b0d7e58b4c69474d4.tar.bz2 itzks-systems-18722a4e156c1402e7366f2b0d7e58b4c69474d4.zip |
sbin/itzks-diskless-re-partition-dlw: Handle NVMe storage devices gracefully.
Diffstat (limited to 'sbin/itzks-diskless-re-partition-dlw')
-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 |