Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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
@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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.