Yesterday, I came across the need to have a multiboot grub4dos USB Flash drive that needs to have different volume labels on the same USB drive at different times!
For instance, when I boot one ISO, the volume label of the flash drive needs to be OODIPRO for O&O DiskImage ISO booting, but some other ISOs require a different or at least a known label - e.g. Trinity Rescue and Fedora. It would be nice if grub4dos could change the volume label of the boot device (e.g. USB Flash drive or HDD).
We can use the grub4dos cat command to change the volume label of a FAT16 or FAT32 USB boot drive as follows:
1. First we need to find the sector that that the volume label is in..
In RMPrepUSB - select your multiboot drive and then hit CTRL-D to invoke Disk Doctor - click on the Search Disk button and search for the volume label - e.g. 'MYLABEL' by entering the search string TMYLABEL (the T denotes a non-case sensitive Text search string) - DiskDoctor should display the sector and the label will usually be at the start of the sector followed by the first files in the directory. The volume label is 11 bytes followed by 08 or 28. If the label is shorter than 11 bytes it is always padded out by spaces (20).
Let us suppose that the sector it finds the volume label in is sector 30704 as shown in the above listing.
2. Now we could change this label to another string in our grub4dos menu.lst using:
this should display '0' (if debug is on) indicating that it found the string OODIPRO at byte 0 in sector 30704 - if it does not display '0' then you have probably got it wrong!
The problem is we need to know what the volume label is currently set to.
However, you could always use this code, which does not need to know what the label is currently set to:
Note that the character after 30704+1 is a vertical bar (OR) character - I recommend you cut and paste the menu so that you get the correct character. Depending on your country and keyboard it may appear as ¦ or | .
You do not need to know which sector the label is in, if you use a large number of sectors to search and already know the volume label - but this will take several seconds and it relies on the volume label being a unique string not found anywhere before the directory entries - e.g.
All of this will only work on FAT volumes though. For NTFS boot drives you would need to modify the code to search and replace unicode 2-byte strings. The length of the string is also crucial, so changing an NTFS volume label is far more complex!