1

Topic: howto change partition numbers on esxi 6.7 usb stick

https://www.virten.net/2014/12/clone-es … sh-drives/

according to the above link, with some clone sw when making clones of vmware esxi USB sticks the partition numbers get rewritten thus the sticks can't boot, which just happened to me. some users mention they changed the partition numbers back to what esxi requires and the sticks can then boot.

below is what the partition number now look like on my main esix usb stick after cloning and i need to change them from (1,2,3,4,5,6) to (1,5,6,7,8,9) respectively.

how can i do that with gparted/parted??

tia

$ sudo sgdisk --print /dev/sdb

Disk /dev/sdb: 62333952 sectors, 29.7 GiB
Sector size (logical/physical): 512/512 bytes
[...]

Number  Start (sector)    End (sector)  Size       Code  Name

   1              64            8191   4.0 MiB     EF00  
   2            8224          520191   250.0 MiB   0700  
   3          520224         1032191   250.0 MiB   0700  
   4         1032224         1257471   110.0 MiB   FC00  
   5         1257504         1843199   286.0 MiB   0700  
   6         1843200         7086079   2.5 GiB     FC00  

2

Re: howto change partition numbers on esxi 6.7 usb stick

My simplest suggestion is to re-clone the USB stick using dd.  That will make a binary copy of the drive, including the partition table, keeping the original partition numbering.

Short background on partition tables.  GPT / Partition entries
Partitions are an array of entries describing each partition.  The first partition is described in entry 1, second partition is described in entry 2, etc.

Therefore when asking to renumber a partition you are asking to blank out that partition entry and write the same partition details into another partition entry.  Also your partition entries are not aligned to whole MiBs.  The start of the first partition is at 32KiB.  GParted can only create partitions aligned to MiBs so you can't use GParted to delete and then re-create the partitions.

What you want can probably be carefully done using sgdisk by manually deleting and re-creating the partitions to re-number them one at a time.  I recommend my first suggestion of re-cloning the USB stick using dd.

3

Re: howto change partition numbers on esxi 6.7 usb stick

mfleetwo wrote:

My simplest suggestion is to re-clone the USB stick using dd.  That will make a binary copy of the drive, including the partition table, keeping the original partition numbering.

Short background on partition tables.  GPT / Partition entries
Partitions are an array of entries describing each partition.  The first partition is described in entry 1, second partition is described in entry 2, etc.

Therefore when asking to renumber a partition you are asking to blank out that partition entry and write the same partition details into another partition entry.  Also your partition entries are not aligned to whole MiBs.  The start of the first partition is at 32KiB.  GParted can only create partitions aligned to MiBs so you can't use GParted to delete and then re-create the partitions.

What you want can probably be carefully done using sgdisk by manually deleting and re-creating the partitions to re-number them one at a time.  I recommend my first suggestion of re-cloning the USB stick using dd.

appreciate the link and education on the partitions.

i have tried dd on the original esxi stick to a saved image on a linux machine. problem is when i first used USB Image Tool to clone that esxi stick, that clone software or win7 somehow changed the partition table on the stick as the above sgdisk --print shows. so, that stick will not boot now and when i `dd`the cloned image made by USB Image Tool or the image made by `dd` from-stick-to-image the data is there but the numbering of the partitions is (1,2,3,4,5,6) and not the (1,5,6,7,8,9) that vmware/esxi requires to boot.

on a few sites where others have had this issue who didn't have a bootable cloned image they mentinoed they changed the partition numbers.

glad you mentioned this can't be done in gparted but can/maybe done with sgdisk.


trying to wrap my head around how to "manually deleting and re-creating the partitions to re-number them one at a time"
does that mean deleting the partitions on say stick A and copying that partition from stick B to the correct numbered partition on stick A ?  or doing all the deleting and re-creating on say, stick A? not sure how to delete a partition with good data and re-creating that partition.

4

Re: howto change partition numbers on esxi 6.7 usb stick

After reading the manual page I think these are the sgdisk commands to delete and re-create the partitions with the new numbers that you are after.
(All the figures just come from your above print output).

sudo sgdisk --delete=6 /dev/sdb
sudo sgdisk --delete=5 /dev/sdb
sudo sgdisk --delete=4 /dev/sdb
sudo sgdisk --delete=3 /dev/sdb
sudo sgdisk --delete=2 /dev/sdb
sudo sgdisk --new=9:1843200:7086079 --type=9:FC00 /dev/sdb
sudo sgdisk --new=8:1257504:1843199 --type=8:0700 /dev/sdb
sudo sgdisk --new=7:1032224:1257471 --type=7:FC00 /dev/sdb
sudo sgdisk --new=6:520224:1032191 --type=6:0700 /dev/sdb
sudo sgdisk --new=5:8224:520191 --type=5:0700 /dev/sdb