Is it possible to set a volume label on a bind mount

in flag

I'm playing around with using bind mounts in order to fake presence of USB removable storage devices in unit test code.

mkdir /tmp/fake_USB_drive

<set up some fake content>

mkdir /media/$USER/fake_USB_drive
sudo mount --bind /tmp/fake_USB_drive /media/$USER/fake_USB_drive

I've got some application code to test that relates to a piece of electronics equipment that connects over USB using mass storage device profile, presenting a custom/known volume label that I query to distinguish it from a generic mass storage device.

I would like to be able to fake this label on my bind mount.

What I've tried:

e2label, which not surprisingly doesn't work, as it expects a device argument

in flag

Looks as though if I use a loop device ( rather than a bind mount to simulate the USB mass storage device, I can successfully use e2label to set a volume label.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.