pkgs/grow-last-partition-and-filesystem: Automatically move GPT backup header to end of device
This commit is contained in:
@@ -10,6 +10,7 @@ writeShellApplication {
|
|||||||
text = builtins.readFile ./grow-last-partition-and-filesystem.sh;
|
text = builtins.readFile ./grow-last-partition-and-filesystem.sh;
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
e2fsprogs
|
e2fsprogs
|
||||||
|
gptfdisk
|
||||||
jq
|
jq
|
||||||
parted
|
parted
|
||||||
];
|
];
|
||||||
|
@@ -11,6 +11,9 @@ fi
|
|||||||
|
|
||||||
DEVICE="$1"
|
DEVICE="$1"
|
||||||
|
|
||||||
|
echo "Move GTP backup header to end of disk"
|
||||||
|
sgdisk "${DEVICE}" --move-second-header
|
||||||
|
|
||||||
PARTITIONDATA="$(parted --script --json --fix "${DEVICE}" print)"
|
PARTITIONDATA="$(parted --script --json --fix "${DEVICE}" print)"
|
||||||
PARTNUMBER="$(echo "${PARTITIONDATA}" | jq -r '.disk.partitions | last | .number')"
|
PARTNUMBER="$(echo "${PARTITIONDATA}" | jq -r '.disk.partitions | last | .number')"
|
||||||
PARTNAME="$(echo "${PARTITIONDATA}" | jq -r '.disk.partitions | last | .name')"
|
PARTNAME="$(echo "${PARTITIONDATA}" | jq -r '.disk.partitions | last | .name')"
|
||||||
|
Reference in New Issue
Block a user