nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

change uuid of an ext3 partition

This is a discussion on change uuid of an ext3 partition within the Shell scripting forums, part of the Development/Scripting category; Hello, Does anyone know how to change the uuid of an existing ext3 partition? I did a dd backup, but ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 04-10-2007, 01:24 PM
Junior Member
 
Join Date: Mar 2007
Posts: 3
Rep Power: 0
allotment is on a distinguished road
Default change uuid of an ext3 partition

Hello,

Does anyone know how to change the uuid of an existing ext3 partition?
I did a dd backup, but now I have 2 partitions with same uuid...
Not that great if I was planning any mounting by uuid

apropos uuid and man page on my mandriva 2007.0 only lead me to
some C libraries. Can C libraries be called simply in bash?
http://www.die.net/doc/linux/man/man...enerate.3.html

I know I have e2fsck installed and all defaults file system utilities like tune2fs.
I need to check e2fsprogs does not provide other things that
are not already installed
http://sourceforge.net/projects/e2fsprogs/

Thanks for the help
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-19-2007, 02:43 AM
Junior Member
 
Join Date: Mar 2007
Posts: 3
Rep Power: 0
allotment is on a distinguished road
Default found a solution

Right, found the answer after reading 5 times the man pages
and a bit of imagination

uuidgen
tune2fs /dev/hdaX -U numbergeneratedbyuuidgen
verification with
vol_id /dev/hdaX

one can use xargs or a variable and ; to make that a one liner

uuidgen | xargs tune2fs /dev/hdaX -U ; vol_id /dev/hdaX

Hope one finds this interesting
Reply With Quote
  #3 (permalink)  
Old 03-02-2008, 09:20 AM
Junior Member
User
 
Join Date: Mar 2008
My distro: Ubuntu
Posts: 1
Rep Power: 0
Revox is on a distinguished road
Thumbs up Thanks for posting your solution

Well, nearly a year later I found it interesting. I recently dd'd (dd'ed?) a clone of my disk, only to run into the whole UUID thing. Your fix worked a treat. Thanks!

--
Revox
Reply With Quote
  #4 (permalink)  
Old 03-24-2008, 09:49 PM
Member
User
 
Join Date: Mar 2008
My distro: Debian, Slackware, LFS
Posts: 83
Rep Power: 1
Tux-Idiot is on a distinguished road
Exclamation OT. kind of not related to topic but yet.

Quote:
Originally Posted by allotment View Post
Right, found the answer after reading 5 times the man pages
and a bit of imagination

uuidgen
tune2fs /dev/hdaX -U numbergeneratedbyuuidgen
verification with
vol_id /dev/hdaX

one can use xargs or a variable and ; to make that a one liner

uuidgen | xargs tune2fs /dev/hdaX -U ; vol_id /dev/hdaX

Hope one finds this interesting

there was once an arguement with /dev/random between me and a friend. and he ended up betting 50 US$. none won, because math behind this very complex. take a look at the gpg project doc and also ssl lib docu.the math behind real time math and number states, the probability of finding consecutive random numbers like 00123498 and 00123499 in 2 consecutive return key is next to impossible.
OPTIONS
-r Generate a random-based UUID. This method creates a UUID consisting mostly of random bits. It requires that
the operating system have a high quality random number generator, such as /dev/random.

-t Generate a time-based UUID. This method creates a UUID based on the system clock plus the system's ethernet
hardware address, if present.

this is the manpage extract. so you can clone up a hdd and get a new UUID and continue. but if you wish to generate exact consecutive too and fro consecutive random numbers? i dont think its possible ever. thats why we got mersenner prime and which is why RSA uses primes via /dev/urandom to generate all crypto keys. and the R1 and R2 where R1 & R2 are 2 unique different generated numbers. thats exactly how when someone uses pirated M$ OS? and go for an upgrade? they get caught as the UUID gen process in any OS is the same. and when set once for one device against time using the hash algorithm? you cannot get a second consecutive or similar random number. frankly impossible unless lightning strikes. plus thats the main science behind RSA safe crypto key seed mechanism. the numbers are generated every 3 seconds from 2 different but unique set of gen.
thats why i cant use the same UUID of the fs in my encrypted usb and i need to do the same again and re run cryptsetup again to do this and generate a hash function for it to mount. afterall the math unit in CPU all it does is? generate an entropy.

and IMO and IMHO the entire crypto is based on r1 and r2 function sets, atleast thats what the crypto howto explains. and everytime i read it? i go to sleep.
Reply With Quote
  #5 (permalink)  
Old 04-20-2008, 02:32 AM
Junior Member
User
 
Join Date: Apr 2008
My distro: Mandriva 2008 spring
Posts: 2
Rep Power: 0
gonzague30 is on a distinguished road
Default

A few days ago I install mandriva 2008.1 spring. But I have 2 of my windows fat 32 partitions missing in fstab, I can see them in the folder tree /mnt.
Ihave 5 fat32 part. sda5 to sda9. sda7 and sda8 are the one missing in fstab and if I try to mount them I get the same content as sda6.
I found out that sda 7 and 8 have the same UUID as sda 6
here is the vol_id for the 5 partitions

[root@localhost gonzague]# vol_id /dev/sda5
ID_FS_USAGE=filesystem
ID_FS_TYPE=vfat
ID_FS_VERSION=FAT32
ID_FS_UUID=41E4-2FDA
ID_FS_UUID_ENC=41E4-2FDA
ID_FS_LABEL=GONZAGUE
ID_FS_LABEL_ENC=GONZAGUE
ID_FS_LABEL_SAFE=GONZAGUE
[root@localhost gonzague]# vol_id /dev/sda6
ID_FS_USAGE=filesystem
ID_FS_TYPE=vfat
ID_FS_VERSION=FAT32
ID_FS_UUID=41E4-2FDB
ID_FS_UUID_ENC=41E4-2FDB
ID_FS_LABEL=LISS
ID_FS_LABEL_ENC=LISS
ID_FS_LABEL_SAFE=LISS
[root@localhost gonzague]# vol_id /dev/sda7
ID_FS_USAGE=filesystem
ID_FS_TYPE=vfat
ID_FS_VERSION=FAT32
ID_FS_UUID=41E4-2FDB
ID_FS_UUID_ENC=41E4-2FDB
ID_FS_LABEL=DOKUMENTER
ID_FS_LABEL_ENC=DOKUMENTER
ID_FS_LABEL_SAFE=DOKUMENTER
[root@localhost gonzague]# vol_id /dev/sda8
ID_FS_USAGE=filesystem
ID_FS_TYPE=vfat
ID_FS_VERSION=FAT32
ID_FS_UUID=41E4-2FDB
ID_FS_UUID_ENC=41E4-2FDB
ID_FS_LABEL=DOWNLOAD
ID_FS_LABEL_ENC=DOWNLOAD
ID_FS_LABEL_SAFE=DOWNLOAD
[root@localhost gonzague]# vol_id /dev/sda9
ID_FS_USAGE=filesystem
ID_FS_TYPE=vfat
ID_FS_VERSION=FAT32
ID_FS_UUID=41E4-2FDC
ID_FS_UUID_ENC=41E4-2FDC
ID_FS_LABEL=DIVERSE
ID_FS_LABEL_ENC=DIVERSE
ID_FS_LABEL_SAFE=DIVERSE

So when I found this thread about changing uuid, I tried allotment command
on sda7 but it didn't work and I got this error:

[root@localhost gonzague]# uuidgen | xargs tune2fs /dev/sda7 -U ; vol_id /dev/sda7
tune2fs 1.40.8 (13-Mar-200
tune2fs: Bad magic number in super-block while trying to open /dev/sda7
Couldn't find valid filesystem superblock.
ID_FS_USAGE=filesystem
ID_FS_TYPE=vfat
ID_FS_VERSION=FAT32
ID_FS_UUID=41E4-2FDB
ID_FS_UUID_ENC=41E4-2FDB
ID_FS_LABEL=DOKUMENTER
ID_FS_LABEL_ENC=DOKUMENTER
ID_FS_LABEL_SAFE=DOKUMENTER
[root@localhost gonzague]#

what does this means and what can I do to change uuid of sda7 and sda8 ? would a clean install of mandriva help to change these uuid ? .
I had mandriva 2008 before and this problem didn't exist

Last edited by gonzague30; 04-20-2008 at 02:37 AM..
Reply With Quote
  #6 (permalink)  
Old 08-29-2008, 08:28 PM
Junior Member
User
 
Join Date: Aug 2008
My distro: Ubuntu
Posts: 3
Rep Power: 0
catswhisker is on a distinguished road
Default fat32 issues

gonzague30,
I don't know if you've found this out yet, but the 'tune2fs' command shown above is only for Linux 'ext' type filesystems, it is not for use with FAT32. The 'bad magic number' message means 'wrong type of filesystem'
Reply With Quote
  #7 (permalink)  
Old 08-29-2008, 08:54 PM
Junior Member
User
 
Join Date: Aug 2008
My distro: Ubuntu
Posts: 3
Rep Power: 0
catswhisker is on a distinguished road
Default more fat32

gonzague30,
As I have had to mess about with uuids I thought I'd have a look around and see how to change them on FAT32, but I just can't find a simple method. The only suggestion I found was editing the raw partition header directly, but this looked as if it could be dodgy since windows may store the uuid in the registry.
I assume you've found a way round this but in case it helps my suggestions in order of my preference are:

1/ Use partition labels instead of UUIDs to reference these partitions in fstab.
2/ Backup, delete and recreate the partitions with duplicate UUIDs
3/ Use /dev/xxxx references instead of UUIDs to reference these partitions in fstab.
Reply With Quote
  #8 (permalink)  
Old 08-29-2008, 11:36 PM
Junior Member
User
 
Join Date: Apr 2008
My distro: Mandriva 2008 spring
Posts: 2
Rep Power: 0
gonzague30 is on a distinguished road
Default

thanks Catswhisker for the answer. Sometime ago I did what you suggest in point /2, I backup the 2 partitions in windows and i booted Mandriva 2008.1 and formated these 2 partitions and it resolves the problem. I was lucky that windows was not on these partitions so i didn't have to reinstall it.
But to avoid this how can I tell the linux os to use the labels instead of uuid in fstab.
Mandriva already uses labels to some extent. In media it uses labels but in /mnt it uses " wndows c, windows d, etc....". it a little bit confusing.
Reply With Quote
  #9 (permalink)  
Old 08-30-2008, 04:54 AM
Junior Member
User
 
Join Date: Aug 2008
My distro: Ubuntu
Posts: 3
Rep Power: 0
catswhisker is on a distinguished road
Default

But to avoid this how can I tell the linux os to use the labels instead of uuid in fstab.

In fstab just replace the UUID=whatever with LABEL=yourlabel
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Retrieval of volume UUID in Mac Ashish Pathak The Hangout 0 04-05-2008 12:21 PM
Difference between ext2 and ext3 Linux file system nixcraft Getting started tutorials 0 05-18-2007 02:43 AM
Differnece between ext2 & ext3 Yasar Linux software 3 04-27-2007 05:10 PM
can ext3 securely delete files Linux software 1 01-11-2006 01:08 PM
ext3 windows ext3 Linux software 1 12-30-2005 01:46 AM


All times are GMT +5.5. The time now is 07:32 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36