Skip to content

Instantly share code, notes, and snippets.

@csamsel
Last active January 12, 2023 11:02
Show Gist options
  • Save csamsel/eb71211bfdaa356c55e62344201354fd to your computer and use it in GitHub Desktop.
Save csamsel/eb71211bfdaa356c55e62344201354fd to your computer and use it in GitHub Desktop.
Add VMware ESXi datastore to install disk using partedUtil
# For me atleast VMware ESXi fails to create a datastore on the drive i installed it on - although enough space is left over.
# You can still do it using partedUtil on the console.
# I'm using a 250 GB Sammsung 860 Evo in this example (/dev/disks/t10.ATA_____Samsung_SSD_860_EVO_250GB_______________S3YJNF0JC02559E____)
#
# First lets check the current partition layout using partedUtil getptbl
[root@oxygen-vmhost2:~] partedUtil getptbl /dev/disks/t10.ATA_____Samsung_SSD_860_EVO_250GB_______________S3YJNF0JC02559E____
_
gpt
30401 255 63 488397168
1 64 8191 C12A7328F81F11D2BA4B00A0C93EC93B systemPartition 128
5 8224 520191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
6 520224 1032191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
7 1032224 1257471 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0
8 1257504 1843199 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0
9 1843200 7086079 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0
# gpt referes to the disk format.
# The number 488397168 is the last sector number of the drive.
# The next free partition number would be 10.
# 7086079 is the last sector number of the last partition.
# To create a partition we use partedUtil add
# 10 is the used partition number.
# 8000000 the first sector of the created partition.
# 488000000 the last sector of the created partition.
# AA31E02A400F11DB9590000C2911D1B8 is the partition type for VMware datastores.
# 0 refers to additional attributes like bootable. We dont need them.
[root@oxygen-vmhost2:~] partedUtil add "/dev/disks/t10.ATA_____Samsung_SSD_860_EVO_250GB_______________S3YJNF0JC02559E_____" gpt "10 8000000 488000000 AA31E02A400F11DB9590000C2911D1B8 0"
gpt
30401 255 63 488397168
1 64 8191 C12A7328F81F11D2BA4B00A0C93EC93B 128
5 8224 520191 EBD0A0A2B9E5443387C068B6B72699C7 0
6 520224 1032191 EBD0A0A2B9E5443387C068B6B72699C7 0
7 1032224 1257471 9D27538040AD11DBBF97000C2911D1B8 0
8 1257504 1843199 EBD0A0A2B9E5443387C068B6B72699C7 0
9 1843200 7086079 9D27538040AD11DBBF97000C2911D1B8 0
10 8000000 488000000 AA31E02A400F11DB9590000C2911D1B8 0
# After the partition was created we can format it using vmkfstools.
# t10 is the HBA, ATA_____Samsung_SSD_860_EVO_250GB_______________S3YJNF0JC02559E_____ the disk, and 10 the partition number.
[root@oxygen-vmhost2:~] vmkfstools -C vmfs6 /vmfs/devices/disks/t10.ATA_____Samsung_SSD_860_EVO_250GB_______________S3YJNF0JC02559E_____:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment