Wednesday, September 3, 2008

Re: [BLUG] changing filesystem UUIDs (was: Amarok)

On Tue, Sep 02, 2008 at 03:06:51PM -0400, Simón Ruiz wrote:
> Ummm, well, UUIDs are funny things.
>
> For one thing, taking the image of a partition and restoring that
> partition on any other media will have the effect of creating a
> filesystem with the same UUID.
>
> This is GREAT if you're taking an Ubuntu image from one machine and
> moving it to another, as your filesystems will have the same UUID and
> thus the mounting will work right.

If you need to change the UUIDs on a Linux ext2/ext3 filesystem, you can
use tune2fs with -U. You can set it to specific UUIDs, you can clear
it, or set it to a generated UUID (either random or based on the time).
Check the man page on 'tune2fs' for details.

> HOWEVER, just as I use images to save time installing a large number
> of machines; it seems that some external hard drive manufacturers have
> taken to using images to save time slapping the read me files onto all
> their hard drives.
>
> I learned this when my computer wouldn't mount both my brand new 1TB
> USB drive and the one my father bought at the same time, same place;
> it thought of them as the same hard drive, since the UUIDs were
> identical.

If this was a FAT filesystem (because it had the readme from the
manufacturer on it) then this would be expected for a number of reasons.
FAT filesystems don't use a UUID, they use a *much* shorter serial
number (64 bits), and it has had a long history of not being set in any
sort of reliable or unique manner. (Third party programs were known to
only use half of it, and clear the other half.) This was due in part
to the small size of the number, as well as the fact that Microsoft's
serial number algorithm was totally undocumented, which meant people
couldn't reproduce it, which lead to people using a simpler method.

In Linux you can use the 'mlabel' command (part of mtools) to change
the serial number of a FAT filesystem. You can use -n to generate a new
random label, or -N to specify your own 8 digit hexadecimal number.

--
Steven Black <blacks@indiana.edu> / KeyID: 8596FA8E
Fingerprint: 108C 089C EFA4 832C BF07 78C2 DE71 5433 8596 FA8E

No comments: