1
0
mirror of https://github.com/tboerger/nixos-config synced 2024-12-03 11:38:14 +01:00

chore: another tra to fix gpt partitioning

This commit is contained in:
Thomas Boerger 2022-10-31 15:22:50 +01:00
parent dd6a2d5bd5
commit 51a077a6d3
No known key found for this signature in database
GPG Key ID: 09745AFF9D63C79B
3 changed files with 17 additions and 29 deletions

@ -40,16 +40,17 @@ if [[ -d /dev/md ]]; then
fi fi
echo "----> Drop existing partitions" echo "----> Drop existing partitions"
wipefs -a /dev/sda || true wipefs -a /dev/disk/by-path/pci-0000:00:14.1-ata-1 || true
sfdisk --delete /dev/sda || true sfdisk --delete /dev/disk/by-path/pci-0000:00:14.1-ata-1 || true
wipefs -a /dev/sdb || true
sfdisk --delete /dev/sdb || true sgdisk --zap-all /dev/disk/by-path/pci-0000:00:11.0-ata-1.0
wipefs -a /dev/sdc || true sgdisk -og /dev/disk/by-path/pci-0000:00:11.0-ata-1.0
sfdisk --delete /dev/sdc || true sgdisk --zap-all /dev/disk/by-path/pci-0000:00:11.0-ata-2.0
wipefs -a /dev/sdd || true sgdisk -og /dev/disk/by-path/pci-0000:00:11.0-ata-2.0
sfdisk --delete /dev/sdd || true sgdisk --zap-all /dev/disk/by-path/pci-0000:00:11.0-ata-3.0
wipefs -a /dev/sde || true sgdisk -og /dev/disk/by-path/pci-0000:00:11.0-ata-3.0
sfdisk --delete /dev/sde || true sgdisk --zap-all /dev/disk/by-path/pci-0000:00:11.0-ata-4.0
sgdisk -og /dev/disk/by-path/pci-0000:00:11.0-ata-4.0
echo "-----> Wait for cleanup" echo "-----> Wait for cleanup"
sleep 3 sleep 3
@ -58,12 +59,6 @@ sync
echo "-----> Mark MBR disks" echo "-----> Mark MBR disks"
echo yes | parted /dev/disk/by-path/pci-0000:00:14.1-ata-1 -- mklabel msdos echo yes | parted /dev/disk/by-path/pci-0000:00:14.1-ata-1 -- mklabel msdos
echo "-----> Mark GPT disks"
echo yes | parted /dev/disk/by-path/pci-0000:00:11.0-ata-1.0 -- mklabel gpt
echo yes | parted /dev/disk/by-path/pci-0000:00:11.0-ata-2.0 -- mklabel gpt
echo yes | parted /dev/disk/by-path/pci-0000:00:11.0-ata-3.0 -- mklabel gpt
echo yes | parted /dev/disk/by-path/pci-0000:00:11.0-ata-4.0 -- mklabel gpt
echo "-----> Create boot partition" echo "-----> Create boot partition"
parted /dev/disk/by-path/pci-0000:00:14.1-ata-1 -- mkpart primary ext4 1MB 1GB parted /dev/disk/by-path/pci-0000:00:14.1-ata-1 -- mkpart primary ext4 1MB 1GB
parted /dev/disk/by-path/pci-0000:00:14.1-ata-1 -- set 1 boot on parted /dev/disk/by-path/pci-0000:00:14.1-ata-1 -- set 1 boot on

@ -33,16 +33,13 @@ for PV in $(pvs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d"
done done
echo "----> Drop existing partitions" echo "----> Drop existing partitions"
wipefs -a /dev/sda || true sgdisk --zap-all /dev/sda
sfdisk --delete /dev/sda || true sgdisk -og /dev/sda
echo "-----> Wait for cleanup" echo "-----> Wait for cleanup"
sleep 3 sleep 3
sync sync
echo "-----> Mark GPT disks"
echo yes | parted /dev/sda -- mklabel gpt
echo "-----> Create boot partition" echo "-----> Create boot partition"
sgdisk -n 0:0:+1G -t 0:ef00 -c 0:boot /dev/sda sgdisk -n 0:0:+1G -t 0:ef00 -c 0:boot /dev/sda

@ -33,19 +33,15 @@ for PV in $(pvs --noheadings 2>/dev/null | sed -e 's/^[[:space:]]*//' | cut -d"
done done
echo "----> Drop existing partitions" echo "----> Drop existing partitions"
wipefs -a /dev/sda || true sgdisk --zap-all /dev/sda
sfdisk --delete /dev/sda || true sgdisk -og /dev/sda
wipefs -a /dev/sdb || true sgdisk --zap-all /dev/sdb
sfdisk --delete /dev/sdb || true sgdisk -og /dev/sdb
echo "-----> Wait for cleanup" echo "-----> Wait for cleanup"
sleep 3 sleep 3
sync sync
echo "-----> Mark GPT disks"
echo yes | parted /dev/sda -- mklabel gpt
echo yes | parted /dev/sdb -- mklabel gpt
echo "-----> Create boot partition" echo "-----> Create boot partition"
sgdisk -n 0:0:+1G -t 0:ef00 -c 0:boot /dev/sda sgdisk -n 0:0:+1G -t 0:ef00 -c 0:boot /dev/sda