Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have an unique situation where I need to change UUID of usb flash drive to previous UUID. I formatted it and obviously number changed...

I've ubuntu server setup with 1TB hdd, and 4GB usb flash drive to boot from. Grub on hdd is configured for UUID which changed when I formated usb drive and reinstalled ubuntu server. I've no external monitor, so I attach usb to laptop and install server there... than I move it to server hardware.

As I mentioned my problem is that I need usb to go back to previous UUID, otherwise server won't boot. And I cannot get external monitor till monday! :)

I know I need these files changed afterwards:

The files for which UUID is most critical:

/boot/grub/menu.lst

/etc/fstab

/etc/initramfs-tools/conf.d/resume

But I cannot find anywhere on the net info about customizing UUID.

Anyone?

share|improve this question

3 Answers

up vote 7 down vote accepted

If you used ext for it:

tune2fs /dev/{device} -U {uuid}

From man tune2fs

-U UUID

Set the universally unique identifier (UUID) of the filesystem to UUID. The format of the UUID is a series of hex digits separated by hyphens, like this: c1b9d5a2-f162-11cf-9ece-0020afc76f16. The UUID parameter may also be one of the following:

clear  clear the filesystem UUID
random generate a new randomly-generated UUID
time   generate a new time-based UUID

The UUID may be used by mount(8), fsck(8), and /etc/fstab(5) (and possibly others) by specifying UUID=uuid instead of a block special device name like /dev/hda1.

share|improve this answer
That worked! But I cannot find: /etc/initramfs-tools/conf.d/resume I found that /boot/grub/menu.lst had been converted to /boot/grub/grub.cfg – Sandro Dzneladze May 5 '12 at 14:32
I have a /etc/initramfs-tools/conf.d/resume on my system. And grub.cfg is indeed the new menu.lst (I think that one came into play with the new grub2. – Rinzwind May 5 '12 at 14:35

comprehensive info:

how-to-retrieve-and-change-partitions-universally-unique-identifier-uuid-on-linux

share|improve this answer
1  
Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Peachy Sep 27 '12 at 22:30

For xfs see man xfs_admin

xfs_admin -U {uuid} {device}

{uuid} can be 'generate' to just get a new uuid.

For reiserfs see man tunefs.reiserfs

tunefs.reiserfs -i {uuid} {device}

For btrfs it seems the uuid is used thoughout the file systems so every node have to be updated. There is no safe way to do that yet.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.