parted /dev/sdb [unit s|MB|B] print : Print drive partition info
parted /dev/sdb mklabel gpt/msdos : Create partition table
parted /dev/sdb
mklabel gpt : create new GPT table?
mkpart : Create a new partiion
mkpart primary ext4 0% 100%
NOTE: In MBR, prompt asks you primary or extended? But in GPT, that is not the case.
With blkid command, you can find the UUID of disks. You can also use lsblk --fs with systemctl daemon-reload you can soft reload all daemons. After changing /etc/fstab, you should use this command.
-
Adding disk to virtual machine
To add disk to your virtual machine, these are the steps.
Identify:
fdisk -lwill show how many disks are connectedfdisk -l 2> /dev/null | egrep ‘^Disk’ | wc -lwill also show disk numberfdisk -l 2> /dev/null | egrep ‘^Disk’ | grep -v mapper | grep -v identifierwill show the best resultsfile:Add disk: In virtual machine settings add disk with your skill.
Mounting: List different connectors (SATA,SCSI,IDE etc.) with commands
ls /sys/class/fc_hostls /sys/class/scsi_hostThen, in folder that which
lscommand returned something type these for all hostsecho "- - -" > /sys/class/scsi_host/host0/scanecho "- - -" > /sys/class/scsi_host/host1/scanetc…
“- - -” are wildcards for channel, SCSI target ID and LUN. The dashes act as wildcards meaning “rescan everything”
After, you can check again if the disk is added with
fdisk -l 2> /dev/null | egrep ‘^Disk’ | grep -v mapper | grep -v identifier