August 30, 2007

So I’ve been at school leading a few events so I’ve finally returned to my desk. I should be around a lot more next week. I wanted to post a solution to a simple problem people have:

Many people have partitions mounted in their fstab as such:

/dev/hda1 /mnt/BSDPartition ext3 auto 0 0

However, the use of hd*, sd*, is not the proper way to mount partitions, but rather byUUID. I had always used /dev/hda1 to mount a partition because I didn’t know how to make a UUID. Turns out its rather easy in the command line. If I list the partitions, I get something like this:

freddy@sepa:~$ sudo fdisk -l

Device Boot Start End Blocks Id System
/dev/sda1 1 22568 181277428+ 83 Linux
/dev/sda2 22569 30349 62500882+ 83 Linux
/dev/sda3 30350 30401 417690 82 Linux swap / Solaris

My music, video, document partition is /dev/sda1 so I do the following:

freddy@sepa:~$ sudo vol_id /dev/sda1

I can then take the line and add something like this in /etc/fstab:

UUID=1ced8e6e-7ee4-450e-b572-012386e1dfc8 /mnt/BSDPartition ext3 auto 0 0


Warning: Use at your own risk, I am no expert at anything so I’m not liable for you messing up your system.

Also, you might notice the host name, there was talk about this on Aaron’s blog. All my computers are named after medical diseases. 🙂


  1. UUID is a crap way to mount partitions, as I discovered this morning. Here is why:

    I have been using Fiesty (x86) on hdb3 for a few weeks now, and I finally decided this past weekend that I no longer needed Mepis on hda1/3. So I backed up files I thought I might want in the future from my home dir, burned a Gutsy Tribe 5 CD, and 2 nights ago I installed Tribe 5 (amd64) on hda1/3. Gutsy (hda1) booted just fine (after I cleared up an Nvidia driver problem), and I used Gutsy up until this morning. When I tried to boot back into Fiesty (hdb3), I had problems. My hdb5 (shared media partition) would not pass a fscheck, and swap refused to mount. The solution? Modify fstab on hdb3 to NOT use the uuid mounting convention. I’m back to golden. 🙂 Not sure of the specifics, but I’m fairly willing to bet that Gutsy assigned different uuid’s to some/all of my partitions, screwing over any other installations (Fiesty, in this case) which were reliant upon the previous existing UUID. I will always use /dev in fstab from now on, because /dev names never change.

  2. UUID is not *the* proper way to mount a partition. It is just another way. It has its advantages and its inconvenients. Don’t use UUID if you are formatting regularly some partitions, as the UUID changes when a partition is formatted. But UUID is cool when using removable peripherals, so they will always mount where you want it to mount.

  3. Okay, I can see that as being a plus. I have very few removable peripherals, though, and they all wind up using the same USB port, so I never have more than one “on” at a time. Let me rephrase my previous statement: “UUID is not for me”, and I was rather miffed about it being the *buntu default this morning…

  4. since you’re not answering your pings… i have a deck for you. i’ll give it to you during family weekend.

  5. o yeah, it is so much more intuitive to type

    UUID=1ced8e6e-7ee4-450e-b572-012386e1dfc8 /mnt/BSDPartition ext3 auto 0 0

    than to type:

    /dev/hda1 /mnt/BSDPartition ext3 auto 0 0

    I cannot understand how I could live without knowing this all my life.

    By the way, this is all supposed to be ironic.

  6. […] change. It did. Not even an fscheck error on hdb5. UUID is crap. Why does Ubuntu use UUID, then? I had it explained to me. UUID is cool when using removable peripherals, so they will always mount where you want it to […]

  7. “However, the use of hd*, sd*, is not the proper way to mount partitions” — Well, it was the only one since 15 years of GNU/Linux, and more for other Unix, so don’t be surprised if not everybody switched to the new scheme 🙂

  8. I personally prefer another option, mount by filesystem label. That has a simple reason: I have full control over the labels.

    Device names (/dev/hda, /dev/sdb) depend on the kernel driver, the setting of hardware jumpers or the physical position at the cable or else, while UUIDs are more or less randomly. A filesystem label is something that I can set as I like. Mount by label looks like this:

    LABEL=fancylabel /media/mountpoint ext3 defaults 0 2

    That’s far more human-readable than an UUID, isn’t it?

    FS label for ext3 can be set by ‘tune2fs -L /dev/…’ (non-destructive), for swap it’s ‘mkswap -L /dev/…’ (destructive, but well, swap-space…).

  9. I had an update in feisty change my UUID and cause my computer not to boot. It was somewhat painful to figure out what had happened. I didn’t narrow it down to which update did it though. The drive was definitely not re-formatted though.

    I didn’t know you could do it by Label, that seems the best to me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: