Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to be able to change the root device, say from sda to sdb, so that I am able to remove sda. I don't believe this is possible with chroot, as I am changing the root folder to a mount point that exists on sda (sdb is not on fstab), so removing it would lock up the system.

Any thoughts how I can do this?

share|improve this question

2 Answers 2

It will take effect on reboot, however the sda, sdb, sdc and so on are assigned by sata port ID on the mother board. If you have another HDD, the turn the comp off, and physically alter the cabling. Before you do that though, check /etc/fstab and make sure the mount points are assigned by UUID and not devID. (A long string of number and letters instead of /dev/sda ). It should hash itself out on boot.

There's no way that I can think of to do it with the system booted and running. Once the initrd located the root device... IDK... and old school init 0 is about all that will alter that, and I think that only works on Solaris... I'm sorry.

share|improve this answer
    
That's ok, you gave me an idea anyway. Maybe I could chroot into the mounted fs, modify inittab, fstab, mtab, rc.sh, then run init. I'll try it –  Hamish Milne May 28 '11 at 19:39

Change your fstab. The usage of the variable device nodes like /dev/sda is discouraged now.

Look at your /dev/disk/by-id/ directory. Mine looks like this:

> ls  /dev/disk/by-id/
[...]
scsi-SATA_WDC_WD15EADS-00_WD-XXXX08150815
scsi-SATA_WDC_WD15EADS-00_WD-XXXX08150815-part1
scsi-SATA_WDC_WD15EADS-00_WD-XXXX08150815-part2
scsi-SATA_WDC_WD15EADS-00_WD-XXXX08150815-part5
usb-Generic_STORAGE_DEVICE_123456789289-0:0
usb-Generic_STORAGE_DEVICE_123456789289-0:1
usb-Generic_STORAGE_DEVICE_123456789289-0:2

There you have your disks including serial numbers. I have a SATA hdd and an USB card reader here.

You can use these links in your boot loader and in /etc/fstab unless your distribution is ancient.

There are also /dev/disk/by-uuid/and/dev/disk/by-label`.

Ah, and don't forget the boot loader. If sda is also the first disk 0x80 that the BIOS sees, you might not have one installed on sdb.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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