[sclug] How to find which /dev/xxx a usb device is on?

Andy Hayward ach at buteo.org
Tue Jun 24 10:02:35 UTC 2008


Opps. I didn't realise my cryptic answer would generate such a debate. :)

Most filesystems (ext2/3, xfs, jfs, fat32?) have a filesytem UUID.
Linux can mount filesystems by UUID instead of device - very useful
for removable devices. Devices may also have UUIDs, but I'm referring
to the filesystem UUID.  The UUID of an ext2/ext3 filesytem can be
found via dump2fs -h, and changed via tune2fs. There exist tools for
other filesystems.

Mounting an encrypted filesystem by UUID is more difficult, since the
UUID (usually part of the superblock) will be encrypted as well. I can
think of at least 3 strategies around this:

1. create 2 partitions on the device. first partition is small,
unencrypted, the second is encrypted. mount the first partition by
UUID, search the mount table to determine the device /dev/sdX, and
then bump the partition identifier to find the second partition. Ugly.

2. create a single unencrypted partition, and create your encrypted
filesystem as a file within this, mounted via loopback.

3. tweak the crypto layer not to encrypt the superblock.

-- ach



More information about the Sclug mailing list