diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-01-27 11:48:56 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-01-27 11:48:56 +0100 |
commit | 574db760b65f5c4ff43a70985836a99c7f3b87b7 (patch) | |
tree | ffc81c353ebdfb66d09d5808f31754bac75ed706 | |
parent | 2c1f95be5369914843b2198b73b7e8b63de3dfd8 (diff) | |
download | itzks-systems-574db760b65f5c4ff43a70985836a99c7f3b87b7.tar.gz itzks-systems-574db760b65f5c4ff43a70985836a99c7f3b87b7.tar.bz2 itzks-systems-574db760b65f5c4ff43a70985836a99c7f3b87b7.zip |
sbin/itzks-diskless-re-partition-dlw: Add file. Provide script that turns any storage device into a DLW swap+scratch storage.
-rwxr-xr-x | sbin/itzks-diskless-re-partition-dlw | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/sbin/itzks-diskless-re-partition-dlw b/sbin/itzks-diskless-re-partition-dlw new file mode 100755 index 0000000..89d4fd2 --- /dev/null +++ b/sbin/itzks-diskless-re-partition-dlw @@ -0,0 +1,50 @@ +#!/bin/bash + +# Copyright (C) 2022 by Mike Gabriel <mike.gabriel@it-zukunft-schule.de> + +# This script is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This script is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +# This scripts turns a storage device into a two-partitioned +# storage, first partition containing 16GB swap space, second +# partition containing a scratch partition for local storage. + +DEV="$1" # pick your disk device + +if [ -z "${DEV}" ]; then + echo "no device given" + exit 1 +fi + +if [ ! -e ${DEV} ]; then + echo "no such device" + exit 1 +fi + +wipefs -a ${DEV} # recommended if you want to swap partition table types + +# partitioning for 16G swapfs and rest as a scratch disk +SWAP_SIZE=16384 + +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 +" | sfdisk ${DEV} + +mkswap ${DEV}1 +mkfs.ext4 -L DLW_SCRATCH ${DEV}
\ No newline at end of file |