LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-09-2010, 12:07 AM   #1
GMHilltop
LQ Newbie
 
Registered: Oct 2010
Posts: 7

Rep: Reputation: 0
Change UUID - Edit UUID using the dd command


I have gone over the thread "Learn The DD Command Revised" (It was Fantastic) in the search for a solution to my query.

I have seen posted elsewhere that this code is supposed to be able to change the UUID number of NTFS partitions (useful when multi-booting with Grub2 and cloning partitions). Here is the code:

Code:
sudo dd if=/dev/urandom bs=80 count=1 | xxd -l 80 -c 8 | tail -1 | xxd -r - /dev/sda1
This is assuming that I want to change the UUID on the 1st partition on the 1st hard drive >>>sda1<<<
If I was trying to modify the 2nd partition on the 1st hard drive it would be >>>sda2<<<

The message that I am getting is:
xxd: /dev/sda1: Permission denied
1+0 records in
1+0 records out
80 bytes (80 B) copied, 4.9104e-05 s, 1.6 MB/s
ubuntu@ubuntu:~$
Now I am not a Linux master at all (I don't understand most of the code that I am seeing here.

I am just testing here and I am not worried about data loss, but it would be very helpful if I could get this to work somehow.

Can anyone point me in the right direction?

NOTE: I was doing this while booting from Ubuntu's Live CD version 10.04.1 LTS (In case that is a factor)

Thanks again for the help!

Last edited by GMHilltop; 10-09-2010 at 12:09 AM. Reason: clarification
 
Old 10-09-2010, 12:44 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,351

Rep: Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041
I would think whoever posted that "code" never actually tested it - you're lucky it didn't work.
And no, I'm not going to tell you how to potentially mangle your NTFS partition.
 
Old 10-09-2010, 06:21 PM   #3
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
Quote:
Originally Posted by GMHilltop View Post
I have gone over the thread "Learn The DD Command Revised" (It was Fantastic) in the search for a solution to my query.

I have seen posted elsewhere that this code is supposed to be able to change the UUID number of NTFS partitions (useful when multi-booting with Grub2 and cloning partitions). Here is the code:

Code:
sudo dd if=/dev/urandom bs=80 count=1 | xxd -l 80 -c 8 | tail -1 | xxd -r - /dev/sda1
This is assuming that I want to change the UUID on the 1st partition on the 1st hard drive >>>sda1<<<
If I was trying to modify the 2nd partition on the 1st hard drive it would be >>>sda2<<<

The message that I am getting is:
xxd: /dev/sda1: Permission denied
1+0 records in
1+0 records out
80 bytes (80 B) copied, 4.9104e-05 s, 1.6 MB/s
ubuntu@ubuntu:~$
Now I am not a Linux master at all (I don't understand most of the code that I am seeing here.

I am just testing here and I am not worried about data loss, but it would be very helpful if I could get this to work somehow.

Can anyone point me in the right direction?

NOTE: I was doing this while booting from Ubuntu's Live CD version 10.04.1 LTS (In case that is a factor)

Thanks again for the help!
From the first post in the thread you reference:
Quote:
Originally Posted by AwesomeMachine View Post
This post contains comprehensive documentation with examples for one of the most useful Linux/UNIX/Windows commands: dd. Dd is a bit-stream duplicator. If you have questions, post them.
You should ask your question in that thread, and allow the author
and those following to read that answer and also reply.

Last edited by Bruce Hill; 10-09-2010 at 06:23 PM.
 
Old 10-09-2010, 07:11 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,351

Rep: Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041
No really Bruce - this is not (strictly) a dd problem.
Conceptually something like the command string presented could do the job of updating the NTFS volume id (NTFS doesn't have a UUID). But it's wrong, and would damage the filesystem if run as-is.
 
Old 10-09-2010, 07:34 PM   #5
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
I'm going to stick by my opinion, and you can have yours.
Code:
silas ~ # blkid
/dev/sdc1: LABEL="Win7" UUID="146066D66066BE5C" TYPE="ntfs"
The OP has a reason for doing what he is doing, and the people
following the DD thread might offer more help that you did here.
 
Old 10-09-2010, 07:40 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,351

Rep: Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041
That's a (Linux) generated UUID, not part of the filesystem. Similar happens for [V]FAT.

I know what the OP is trying to do - that ain't the way to do it.
 
Old 10-09-2010, 07:47 PM   #7
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
Quote:
Originally Posted by syg00 View Post
I know what the OP is trying to do - that ain't the way to do it.
Then if you do, by all means, tell him!
 
Old 10-09-2010, 08:47 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,351

Rep: Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041Reputation: 1041
The OP is involved in a same named thread on ubuntuforums. That thread is an info thread on how to do this.
The OP is trying to use a "short cut" that was also posted there. Bad decision - especially if you don't know what the commands are doing.
 
Old 10-10-2010, 12:49 PM   #9
GMHilltop
LQ Newbie
 
Registered: Oct 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
. . . And no, I'm not going to tell you how to potentially mangle your NTFS partition.
You have NO IDEA what it is I am trying to do. I'm not a 10 year old on my momma's computer looking to screw with it. It is MY partition and I can "mangle" it if I want too!

Your response was hardly helpful. (Where is the link at the bottom of your post that says: Did you find this post helpful? NO )

I came here to LEARN.

syg00, READ my WHOLE post AGAIN. Emphasis on: I am just testing here and I am not worried about data loss, but it would be very helpful if I could get this to work somehow.

I am here to leverage your experience not be patronized by it.

If I screw with MY file system I can image it back in a couple of seconds.

Quote:
Originally Posted by syg00 View Post
. . .
Conceptually something like the command string presented could do the job of updating the NTFS volume id (NTFS doesn't have a UUID). But it's wrong, and would damage the filesystem if run as-is.
... and...?

Quote:
Originally Posted by syg00 View Post
. . . it's wrong, and would damage the filesystem if run as-is.
Actually I DID run it (READ MY POST AGAIN) and it didn't DO anything.
READ my WHOLE post again.

If it is wrong, explain to me why - especially if:
Quote:
Originally Posted by syg00 View Post
. . . you're lucky it didn't work....
How's that? Maybe YOU don't know what everything in that code I posted is - I've already admitted that I don't. It didn't do anything when I ran it, so how is it I am lucky that it didn't work?

Quote:
Originally Posted by syg00 View Post
I know what the OP is trying to do - that ain't the way to do it.
I don't think you have a clue what it is (Ultimately) that I am trying to accomplish. But all you needed to do is ask.

I have imaged an OS after fully configuring it.
I can then image it onto the 1st and 2nd partition of my drive.
Once that is done I want to boot them with GRUB2.

If you know anything about Grub2 you'll know this is easily possible as long as the UUID's are not the SAME. (OR I could just use the original GRUB and not GRUB2 - but that is not what this thread is SUPPOSED to be about).

This SAVES me having to reload the OS & ALL the drivers, etc, etc, etc, just to get a different UUID for the 2nd partition. It should be a simple dd command and literally take 2 seconds to do.

Quote:
Originally Posted by syg00 View Post
The OP is involved in a same named thread on ubuntuforums. That thread is an info thread on how to do this.
... this is important how?
Why would you waste your time (and mine) searching that out when you could just have answered the question?

Why DID you respond to my post anyway?

Quote:
Originally Posted by syg00 View Post
. . . The OP is trying to use a "short cut" that was also posted there.
Actually it has been posted in more than one spot on the Internet -- again this is important how?

Quote:
Originally Posted by syg00 View Post
... Bad decision - especially if you don't know what the commands are doing.
syg00, READ my WHOLE post AGAIN. With EXTRA EMPHASIS on:
I am just testing here and I am not worried about data loss....
&
Emphasis on: Now I am not a Linux master at all (I don't understand most of the code that I am seeing here).====> Let me interpret this for you: It means I am here to learn.

syg00, how would you do this if you were to do it?
Maybe a better question is, "Do you really KNOW how to do this, or are you here to just roll new comers"?

Quote:
Originally Posted by Bruce Hill View Post
Then if you do, by all means, tell him!
Thanks for the support Bruce! I didn't see THIS particular command on the tread Posted by AwesomeMachine. I wasn't sure it was quite the right place for it - I'm not sure why I thought that.

Can we get back to learning? Does anyone have anything useful to contribute?
 
Old 10-26-2010, 02:03 AM   #10
dcstar
LQ Newbie
 
Registered: Feb 2005
Distribution: Ubuntu 10.04
Posts: 4

Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
I would think whoever posted that "code" never actually tested it - you're lucky it didn't work.
And no, I'm not going to tell you how to potentially mangle your NTFS partition.
Total, absolute rubbish. I created that shortcut code to do exactly the same thing that the original thread achieved with manually copying and editing of the first block of a NTFS partition. That code was tested and confirmed to work by other people as well.

If you don't understand what the code is doing just say so and don't make up stories driven by your own lack of understanding.

As with all direct manipulation of partitions, people have to be aware of the risks involved and be confident that they are doing the right thing and have backups of their data.

Since the whole purpose of the UUID change is to access a NTFS partition you have just duplicated by a different UUID, it is an implied assumption that you can replace that duplicate partition anyway.
 
Old 10-28-2010, 07:39 PM   #11
GMHilltop
LQ Newbie
 
Registered: Oct 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Solution to Changing or Modifying the UUID of an NTFS Partition

Ok, THIS I got to work for me - Hopefully it helps others as well.

First credit where credit is due - I got the help I was looking for here:

Changing / Modifying an NTFS partitions UUID using dd


Thank You very much to Simon Williams for taking the time to respond (See the comments to Adam's original post there). I hope everyone here finds this as useful.

Here is The Code used:

Code:
sudo dd if=/dev/urandom of=/dev/[ntfspartition] bs=8 count=1 seek=9
!!!!!!!!!!!!!!! WARNING WARNING WARNING !!!!!!!!!!!
For [ntfspartition] YOU MUST make sure you Identify the PROPER partition!!
ie: sda1 or sda2 or sdb1 or sdb2 or sdc1 or sdc2 etc etc etc.
DO NOT put sda in there or you will SCREW your MBR !
Also you will want to run: sudo blkid to make SURE you are modifying the proper partition.
DO NOT miss any part of the code above or you'll risk modifying more than just the UUID
also posted at the above link with regard to the above code:
Be warned that you can cause data loss ON ANY DISK CONNECTED TO YOUR MACHINE if you specify the wrong disk or partition, or if the partition you specify turns out to not be the one you were expecting. Disks of the "new" form /dev/sda (rather than the old /dev/hda, etc) have unpredictable ordering. Running this on a non-NTFS partition, or worse, the entire disk (e.g. /dev/sda rather than /dev/sda1) will mess things up very badly. YOU HAVE BEEN WARNED.
!!!!!!!!!!!!!!! END OF WARNING !!!!!!!!!!!!!!!!

as an example of the the code to be used --- if I wanted to modify the UUID of the 1st partition of the first hard drive IN MY SYSTEM this is what I would type:

sudo dd if=/dev/urandom of=/dev/sda1 bs=8 count=1 seek=9

to do the 2nd partition of the first hard drive it would be:

sudo dd if=/dev/urandom of=/dev/sda2 bs=8 count=1 seek=9

(Again - best verify what the system sees IN YOUR SYSTEM by typing in Sudo blkid)

Simon Williams gives a very nice breakdown as to what each piece of the code does for those who are interested (Again - it is in the comments to the original post there).
I think it is the 11th comment that starts off with "dd explained"
Comment 14 by Simon Williams that starts off with "written by Simon Williams, October 13, 2010
Yey, now that I can login again... :S
"
gives even further detail to this part of the code:
/dev/urandom

Again Thanks again to Simon Williams for the assistance. He was very professional and courteous!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
uuid problem _Linux_Learner Linux - Newbie 10 02-26-2010 11:35 PM
Volume has problems including no uuid in /dev/disk/by-uuid abejarano Linux - Hardware 3 12-31-2008 08:41 PM
3 Partitions have the same UUID - how change it ? joe132 Linux - Hardware 5 12-07-2008 09:25 PM
Change Partition Number, does UUID change? aragon127 Linux - Software 1 11-24-2006 12:11 PM
Uuid hansi umayangan Linux - General 2 03-14-2005 04:57 AM


All times are GMT -5. The time now is 11:24 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration