9

I am creating my first Arch Linux install script, and I want to automate the base installation as in the archwiki or you can find the same instructions but easier to read here: https://www.gloriouseggroll.tv/arch-linux-efi-install-guide/

I wish to wipe the partition tables, manually I have to type this:

gdisk /dev/sda
x
z
y
y

I want the bash script to automatically do this.

Spacecow
  • 183
  • 2
  • 7
  • Welcome to U&L! Please could you include a link to the Archwiki page containing the instructions you are attempting to follow? – JigglyNaga Oct 08 '18 at 18:52
  • @don_crissti: I would say that qualifies as an answer, not a comment. If you ping me, I'll come back and upvote. **;-)** – Fabby Oct 08 '18 at 19:11
  • @JigglyNaga Thank you! The installation instructions are here: https://wiki.archlinux.org/index.php/installation_guide to be very specific, I am skipping some of the (minor) steps there. I am usually installing Arch exactly like so: https://www.gloriouseggroll.tv/arch-linux-efi-install-guide/ (actually it is just the same as in the Archwiki, just easier to follow in my opinion). – Spacecow Oct 08 '18 at 19:23
  • @don_crissti I just found out about sgdisk! What I have right now: sgdisk -Z /dev/sdX || Equals to gdisk /dev/sda (+expert commands: x, z, y, y) – Spacecow Oct 08 '18 at 19:28

1 Answers1

14

Per the author of gdisk, Rod Smith, the proper tool for this kind of job is sgdisk — a command-line program intended for use in scripts or by experts who need quick and direct access to a specific feature.
The equivalent of gdisk's interactive x,z,y,y (wiping out GPT data) is

sgdisk --zap-all /dev/sda

or

sgdisk -Z /dev/sda
don_crissti
  • 79,330
  • 30
  • 216
  • 245