How do I identify the partitions of my hard drive in order to then shred them all?

I need to safely format my hardrive. I booted from a usb key and I am planning to run the following command on the whole hard drive:

sudo shred -v -n3 -z /dev/the-partition

My question is: how do I identify all the partitions that there are in order to totally wipe out the hard drive?

Here's the output of lsblk

NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0     7:0    0   1.8G  1 loop /rofs
loop1     7:1    0    91M  1 loop /snap/core/6350
loop2     7:2    0  34.6M  1 loop /snap/gtk-common-themes/818
loop3     7:3    0 140.7M  1 loop /snap/gnome-3-26-1604/74
loop4     7:4    0   2.3M  1 loop /snap/gnome-calculator/260
loop5     7:5    0    13M  1 loop /snap/gnome-characters/139
loop6     7:6    0  14.5M  1 loop /snap/gnome-logs/45
loop7     7:7    0   3.7M  1 loop /snap/gnome-system-monitor/57
sda       8:0    1   7.5G  0 disk /cdrom
├─sda1    8:1    1   1.9G  0 part 
└─sda2    8:2    1   2.4M  0 part 
nvme0n1 259:0    0 238.5G  0 disk 

and here's is df -h

Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           786M  1.7M  785M   1% /run
/dev/sda        1.9G  1.9G     0 100% /cdrom
/dev/loop0      1.8G  1.8G     0 100% /rofs
/cow            3.9G  331M  3.6G   9% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           3.9G     0  3.9G   0% /tmp
tmpfs           786M   44K  786M   1% /run/user/999
/dev/loop1       91M   91M     0 100% /snap/core/6350
/dev/loop2       35M   35M     0 100% /snap/gtk-common-themes/818
/dev/loop3      141M  141M     0 100% /snap/gnome-3-26-1604/74
/dev/loop4      2.3M  2.3M     0 100% /snap/gnome-calculator/260
/dev/loop5       13M   13M     0 100% /snap/gnome-characters/139
/dev/loop6       15M   15M     0 100% /snap/gnome-logs/45
/dev/loop7      3.8M  3.8M     0 100% /snap/gnome-system-monitor/57

Solution 1:

Why not shred then entire device (important! choose the right device to shred!):

shred /dev/nvme0n1

... rather than

shred /dev/nvme0n1p1

Solution 2:

I like lsblk, it show device name and partition inside it, as well the mounted partition.

:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465,8G  0 disk 
├─sda1   8:1    0   100M  0 part 
├─sda2   8:2    0   122G  0 part 
├─sda3   8:3    0     1K  0 part 
├─sda5   8:5    0   7,6G  0 part [SWAP]
├─sda6   8:6    0  69,9G  0 part /
└─sda7   8:7    0 266,2G  0 part /home
sr0     11:0    1  1024M  0 rom

sudo fdisk -l gives more detail, but it requires superuser access.

~$ sudo fdisk -l
Disk /dev/sda: 465,8 GiB, 500107862016 bytes, 976773168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xe0ec1799

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048    206847    204800   100M  7 HPFS/NTFS/exFAT
/dev/sda2          206848 255999999 255793152   122G  7 HPFS/NTFS/exFAT
/dev/sda3       256002046 976771071 720769026 343,7G  5 Extended
/dev/sda5       256002048 272001023  15998976   7,6G 82 Linux swap / Solaris
/dev/sda6       272003072 418486271 146483200  69,9G 83 Linux
/dev/sda7       418488320 976771071 558282752 266,2G 83 Linux

I always uses lsblk to detect the drive, then register /dev/zero to wipe the disk.