I have an USB flash drive that I formerly used as installation medium for Linux Fedora.
The stick still has the "Fedora Live USB" installation files on it. When I insert it into my olde laptoppe, it appears as disk named "Fedora-Live-KDE-x86_64-22-3" in KDE dolphin. Fair enough.
So, I destroy all partitions on it using
fdisk, create new partition, set up an ext4 filesystem on said partition.
I insert the flash drive. I appears as "Fedora-Live-KDE-x86_64-22-3" in KDE dolphin.
UNDEAD FLASH DRIVE TIME!
Where does that name come from? Feels like it does not come from the USB flash drive, but factoid (3) below indicates that it actually does.
Where is that name coming from and how do I change it?
Here is some research on where the name is coming from, the conclusion being that it apparently comes from the ISO-9660 data left on the disk. But how is this sane behaviour by Linux?
e2label /dev/sdd1 shows nothing: the filesystem has no label
blkid /dev/sdd1 shows
/dev/sdd1: UUID="10aab422-4212-45c8-9f99-35e5eb719154" TYPE="ext4" PARTUUID="5c4a815c-01"
▶ Using the flash drive on another machine also results in the name "Fedora-Live-KDE-x86_64-22-3" being displayed.
▶ One can dump the "labels" (whatever those are) by looking at the filesystem under
ls -l /dev/disk/by-label/
This shows the symlink
Fedora-Live-KDE-x86_64-22-3 -> ../../sdb
Note that the symlink points to the device, not the partition. So this is not a filesystem label, but something like a "disk label".
▶ The original "filesystem label" obtainable with
e2label being empty, we set it and then see what's up:
# e2label /dev/sdb1 "Scooby Doo" # ls -l /dev/disk/by-label/ lrwxrwxrwx. 1 root root 9 Feb 4 23:43 Fedora-Live-KDE-x86_64-22-3 -> ../../sdb lrwxrwxrwx. 1 root root 10 Feb 4 23:43 Scooby\x20Doo -> ../../sdb1
So now both the disk and the filesystem/partition have a label. However, after removal/reinsertion, dolphin (or rather, Linux) now settles on the "Scooby Doo" name of the filesystem. And why not! We can then erase the label again using
e2label /dev/sdb1 "" ... and then the name is back, but only partially: "Fedora-Live-KDE-" (why partially? because it's read from 0x9000 onwards, whereas the full label is at 0x8000, see below)
▶ Also tried to see what
parted does. It seems mightily confused: It thinks the 8GiB stick with 512-byte blocks is actually a 32GiB stick with 2048-byte blocks and detects a Apple partition, while
fdisk is absolutely happy with finding an 8GiB Linux partition. Curioser and curioser.
(parted) print Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. Ignore/Cancel? i Model: Generic USB Flash Disk (scsi) Disk /dev/sdb: 32.2GB Sector size (logical/physical): 2048B/512B Partition Table: mac Disk Flags: Number Start End Size File system Name Flags 1 2048B 10.2kB 8192B Apple 2 88.1kB 5278kB 5190kB EFI 3 5319kB 26.1MB 20.8MB EFI
It's probably not TOTALLY confused because on the stick we find this:
▶ Additional weirdness: The reformatted USB stick seems to be un-writeable but traversable for a non-root user. Writing as root works though. But that's just a side remark.
▶ Getting a diskdump with
okteta shows the disk name string at position just past 0x8000, i.e. in block 64 (blocks being 512-Byte-sized):
This evidently stems from the LiveCD structure.
▶ Looking further shows the name again likely in UTF-16 format just past 0x9000, with the version suffix dropped probably because the field has constant size:
▶ Time to POKE and see what happens. We modify the string at the 0x8000 mark:
We also modify the string at the 0x9000 mark:
Then write the blocks back to the stick (because we have been modifiying a file obtained using
dd), sync, sync and eject.
Then reinsert the stick. Linux settles in this case on the string at 0x9000.
[root@elf ~]# ls -l /dev/disk/by-label/ total 0 lrwxrwxrwx. 1 root root 10 Feb 9 22:09 DellUtility -> ../../sda1 lrwxrwxrwx. 1 root root 10 Feb 9 23:20 MOTHRA-Dead-KDE- -> ../../sdb1 lrwxrwxrwx. 1 root root 10 Feb 9 22:09 OS -> ../../sda2 lrwxrwxrwx. 1 root root 10 Feb 9 22:09 RECOVERY -> ../../sda4
Dolphin shows the content of
So, we know where the string comes from. It does not seem useful to be able to change it as it comes from the CD-ROM structure, whereas we have put a standard partitioning scheme onto the USB disk. Why does Linux mash these two two structures?