Checks your disks

 1# check partion 
 2parted -l /dev/sda
 3fdisk -l 
 4
 5# check partition - visible before the mkfs
 6ls /sys/sda/sda*    
 7ls /dev/sd* 
 8
 9# give partition after the mkfs or pvcreate
10blkid
11blkid -o list
12
13# summary about the disks, partitions, FS and LVM 
14lsblk   
15lsblk -f

Create Partition 1 on disk sdb

in script mode

1# with fdisk 
2printf "n\np\n1\n\n\nt\n8e\nw\n" | sudo fdisk "/dev/sdb"
3
4# with parted
5sudo parted /dev/sdb mklabel gpt mkpart primary 1 100% set 1 lvm on

Gparted : interface graphique (ce base sur parted un utilitaire GNU - Table GPT)

Rescan

Inform OS that the partitionning table changed (so you do not need to reboot)

 1# [RHEL6]   
 2partx -a /dev/sda
 3
 4# [RHEL6/7] 
 5partprobe
 6
 7# [RHEL7]  
 8partx -u /dev/sdq
 9kpartx -u /dev/sdq
10
11# [RHEL8]   
12udevadm settle
13
14# [Manual] 
15for x in /sys/class/scsi_disk/*; do echo '1' > $x/device/rescan; done
16for BUS in /sys/class/scsi_host/host*/scan; do    echo "- - -" >  ${BUS}; done
17
18# same as above with sudo 
19sudo sh -c 'for x in /sys/class/scsi_disk/*; do echo "1" > $x/device/rescan; done'
20sudo sh -c 'for BUS in /sys/class/scsi_host/host*/scan; do  echo "- - -" >  ${BUS} ; done '

โš ๏ธ Cleanup and erase disks โš ๏ธ

Here you wipe staff, do not expect to get it back !

 1wipe -a /dev/sda3
 2wipefs -a  /dev/sd[c-z] 
 3
 4# in RHEL 5
 5shred -n 5 -vz /dev/sdb 
 6
 7# check; the following should return nothing 
 8wipefs /dev/sd[c-z]  
 9
10# old school way
11dd if=/dev/urandom of=/dev/sdX bs=4k
12dd if=/dev/zero of=/dev/sdp1 bs=512 count=10 
13
14# When you like to do several disks at once... 
15umount /dev/cciss/c0d{1..6}p1
16for i in {1..6}; do parted -s /dev/cciss/c0d${i} rm 1 ; done
17for i in {1..6}; do echo "nohup sh -c \"shred -vfz -n 3 /dev/cciss/c0d${i} > nohup${i}.out 2>&1 \" &" ; done | bash 

Dban Autonuke ๐Ÿ’ฃ โ€“ this also work when it comes to erase all disks…
https://sourceforge.net/projects/dban/files/dban/ dban-1.0.7 => Previous Version for HP ilo2 with Array cciss dban-2.3.0 => Recent Version

Partitioning

Hard disks:

  • sdx = SCSI/SATA disks
  • hdx = IDE/parallel-ATA disks
  • md0 = mdadm disks which is a RAID software
  • vda = virtual disks

in BSD/Solaris naming convention is different cXtXdX = (c = controler, t = target, d = device)

Patitions labels are just for informations purpose: 5 => extended partitions 7 => NTFS Windows 82 => SWAP 83 => standard partition (needed for /boot) 8e => LVM partition

Remember that primary partitions are limited to 4. so if you need more partition one of the primary should be define as extended.
But in BSD and Solaris, the logic is different. Parition are considered as slice and you can have from 0 to 7 slices (so 8 slices possible), which explain why naming convention is different.