tech.howto.fdisk.scripting.md

Mon Sep 14 10:29:36 AM EDT 2026

scripting with fdisk

they [1] say sfdisk may be better though

fdisk /dev/xvda <<EEOF
d
n
p
1
1

w
EEOF
exit 0
fdisk /dev/sda << EOF
p
EOF

references

1 https://stackoverflow.com/questions/35166147/bash-script-with-fdisk