On my Pi, the disk/SD card is called mmcblk0 with two partitions mmcblk0p1 and mmcblk0p2:
pi@ph5:~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
mmcblk0 179:0 0 14.9G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 14.6G 0 part /
pi@ph5:~ $ sudo parted -l /dev/mmcblk0
Model: SD SU16G (sd/mmc)
Disk /dev/mmcblk0: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 4194kB 273MB 268MB primary fat32 lba
2 273MB 15.9GB 15.7GB primary ext4
If want to create a disk image live, you can run below command.
But the backup path below (the of= argument) cant reside on the same SD card or the disk would run full.
Need to write the backup image to a larger mounted NFS or CIFS share.
Or maybe to a connected USB stick or HDD.
sudo dd status=progress conv=noerror,sync if=/dev/mmcblk0 of='/mnt/path/to/backup/location/pi.hole.img'
Shrink and gzip the resulting image pi.hole.img with below for archiving (thanks to Bucking_Horn for the link):