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

I want the bash script to automatically do this.

  • Welcome to U&L! Please could you include a link to the Archwiki page containing the instructions you are attempting to follow? – JigglyNaga Oct 8 '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 8 '18 at 19:11
  • @JigglyNaga Thank you! The installation instructions are here: 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: 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 8 '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 8 '18 at 19:28

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


sgdisk -Z /dev/sda
  • Yep! This is it :) and it is working in my script. – Spacecow Oct 8 '18 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.