LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-06-2009, 08:29 AM   #1
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Changing disk volume id


Hi all,

I was wondering if it was possible to change the volume ID of a disk without deleting all data on that disk.

Current situation:

- 2 sata disks (sdc and sdd),
- Disk sdc has 3 partitions (sdc1,2,3),
- Cloned sdc to sdd (the whole disk, not individual partitions with the dd command),
- Changed UUID's for sdd1,2,3 partitions to new unique UUID's with tune2fs -U xxx (was none-unique due to cloning).

No problems this far.

The problem:

sdc has the same Volume ID as sdd and the bootloader sees this as an error (no show stopper, "just" an error).

tune2fs and e2label are not able to change the disk volume ID and a google search points to 3rd party tools which should be able to do this.

Questions:

- Is there a way to set the volume ID of a disk with the default linux tools without erasing the disk or am I forced to use 3rd party tools?

- If a 3rd party tool has to be used, does anyone have good experiences with a specific one?

Thanks in advance!
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 12-06-2009, 01:19 PM   #2
funnyG
LQ Newbie
 
Registered: Jun 2004
Location: Germany
Distribution: Slackware 12.2
Posts: 23

Rep: Reputation: 20
Hello,

Well, this might not be the cleanest solution but I have just tried it with my own disk and it worked.

The volume id of the disk consists of 4 bytes and is stored in the master boot record. You can find out your current volume ids with:

lilo -T vol-ID

Then you can copy your current MBR somewhere on your disk with:

dd if=/dev/sdd of=/mbr bs=512 count=1

You should copy this file another time so that you have a backup because you are going to edit the original mbr file. Then open the mbr file with a hex editor of your choice; I chose hexedit, available from here: http://prigaux.chez.com/hexedit.html.

Then look for your volume id somewhere near the end of the file. The volume id should show up between position 0x1B8 - 0x1BB. The bytes are reversed probably because one of the programs uses big endian, the other little endian byte ordering.

Then simply alter like the first of the four bytes of the volume id, and copy the mbr file back into the master boot record of your disk with:

dd if=/mbr of=/dev/sdd bs=512 count=1

Then restart.

Should there be any complaints about the volume id after restart, run lilo again.

In case this doesn't work you still have your backup mbr file so that you can copy it back onto the disk.
 
4 members found this post helpful.
Old 12-06-2009, 01:33 PM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
I just did this the other day, but forget what I did

My history is gone as I have reinstalled a couple of times on the PC I was experimenting with, and it was not an important disk (usb), but I remember being pleasantly surprised how easy it was to change the label.

Quote:
tune2fs and e2label are not able to change the disk volume ID
Why not? What errors? Details please.

How is your disk formatted?
 
0 members found this post helpful.
Old 12-06-2009, 02:13 PM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Original Poster
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
@funnyG: I'll check out your suggestion tomorrow

@tredegar: tune2fs and e2label only work on ext2 and/or ext3 partitions (i.e: /dev/sdd1), not on disks (/dev/sdd, not "formatted"). I'm not talking about volume-labels on partitions but the disk volume ID.

Thanks for the responses so far!
 
Old 12-06-2009, 02:26 PM   #5
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Original Poster
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi again,

Couldn't wait till tomorrow

Thanks funnyG, that solved the problem!

Last edited by druuna; 10-23-2010 at 12:01 PM. Reason: fixed spelling
 
Old 12-06-2009, 04:32 PM   #6
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
Thanks tredegar, that solved the problem!
Please post what "solved the problem".

So just list the commands that you used to change the volume ID for your disk.

..And it was formatted as .. ?
 
0 members found this post helpful.
Old 12-06-2009, 04:45 PM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Original Poster
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Quote:
Originally Posted by tredegar View Post
Please post what "solved the problem".

So just list the commands that you used to change the volume ID for your disk.
The obviously good instructions given in post number 2......

Quote:
..And it was formatted as .. ?
Like I stated in my previous post: A raw disk is not formatted! Partitions are.
 
1 members found this post helpful.
Old 12-06-2009, 05:21 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
I believe if it's (binary) zeros, any of the fdisk derivatives will regenerate a volid on write-back. Maybe easiest just to zap it using "dd".
 
0 members found this post helpful.
Old 02-18-2015, 04:00 AM   #9
a-relieved-pup-here
LQ Newbie
 
Registered: Jul 2010
Posts: 12

Rep: Reputation: 1
Smile Re: Disk Identifier

I stumbled across it. In fdisk expert menu ('x'), 'i' allows entering disk identifier. It needs to begin with the hex prepend of 0x. Like if 'p' (print partition info), in main menu shows disk identifier as 'b118ce61' it could be entered different, like '0xf9f9e8e8' in expert menu's 'i' option. New 'f9f9e8e8' disk identifier would be seen. Remember to return to main menu and 'w' write to disk. 'partprobe' or reboot might be needed for changes to be seen using 'blkid'.

Last edited by a-relieved-pup-here; 02-18-2015 at 06:29 PM. Reason: additional, crap! re-edit, final edit.
 
1 members found this post helpful.
  


Reply



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
changing pv with its multipath volume emrebilmuh Linux - Enterprise 4 09-14-2009 12:01 PM
changing system volume in C knobby67 Programming 0 08-23-2006 01:21 PM
changing volume in mplayer jods Linux - Software 4 03-30-2004 04:42 PM
kmix not changing volume Moebius Linux - Software 0 02-15-2004 07:17 PM
Changing sound volume cli_man Linux - General 6 06-11-2002 05:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:50 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration