0

I know this has been asked many times, but I can't find a straight answer.

I have 2 SSD installed on my computer, /dev/sda and /dev/sdb, I ran dd to create a clone of /dev/sda into /dev/sdb, but when I restart the computer it starts using /boot from /dev/sda1 and the / folder from /dev/sdb2 and I don't want that, I want when it starts with /dev/sda to use only sda and when starting with sdb to use only sdb, I tried running update-grub, but I get nowhere with it, what can I do to fix this?

Thanks.

1
  • 1
    If you remove sdb, will the PC boot OK from sda,, and vice versa? – K7AAY Jul 18 '18 at 21:19
1

Never mind, I did using:

uuidgen
tune2fs -U '<uuid generated>' /dev/sdb2

And it shows now with a different UUID, GRUB2 has been customized using grub-customizer and triple checked that the UUIDs of the 2 boot drives were different.

Thanks for the suggestion though, it was very helpful.

1
  • Great! I learn something new from this. thanks. – Bernard Wei Jul 19 '18 at 17:52
1

When you use dd to copy the 2 SSD's, it copy everything, including the partition and the ext4 UID. When booting up /dev/sda1, it tries to mount the root filesytem that matches with the configured UID. It just so happens that it found it on /dev/sdb2 and hence started using it instead of /dev/sda2.

To fix this, you will need to regenerate the UID for /dev/sdb2

sudo tune2fs -U random /dev/sdb2

If you need the grub bootloader to use /dev/sdb2 when booting from /dev/sdb1, you will need to update the grub setting in /dev/sdb1 to look for the new UID you have just generated.

Edited: Some additional info. You can quickly check the UUID using the blkid command.

blkid

Note that changing UUID requires files system is clean, so it may not be possible to update a mounted filesystem.

3
  • I did that but /dev/sdb2 still shows the same UUID of /dev/sda2 – jfha73 Jul 19 '18 at 15:34
  • Ah sorry, I got the uuid mxed up, may be the random doesn't do it. I'll add instruction to use uuid generator. – Bernard Wei Jul 19 '18 at 17:29
  • Deleted: saw your post, glad you have your problem solved. – Bernard Wei Jul 19 '18 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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