/
[SystemsAdmin] Clearing disk partitions via CLI

[SystemsAdmin] Clearing disk partitions via CLI

  • List block devices of type disk
    lsblk -d -n -o kname, type| grep disk | awk '{print $1}'

  • remove block device MBR and GPT information
    `sgdisk -Z /dev/[DEVICE]

#!/usr/bin/env bash diskList=$(lsblk -d -n -o kname,type | grep disk | awk '{print $1}') for disk in $diskList do cmd="sgdisk -Z /dev/$disk" echo $cmd done

 

Related content

[Ubuntu] How to fully delete LVM partition
[Ubuntu] How to fully delete LVM partition
More like this
[CentOS 7.x] Formatting drive to ext4 and creating partition
[CentOS 7.x] Formatting drive to ext4 and creating partition
More like this
Removing drives (TWS-1675363)
Removing drives (TWS-1675363)
More like this
[Linux] Managing partitions using Terminal
[Linux] Managing partitions using Terminal
More like this
[Ubuntu] How to delete SWAP partition during Ubuntu install
[Ubuntu] How to delete SWAP partition during Ubuntu install
More like this