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've a Linux Centos (5.0) machine with 2 disks. I was changing the SATA cable to one of the disk when I realized that depending on what SATA slot I'm using, the OS starts from sda or sdb.

The problem is that I have daily backups from sda to sdb (merely copies), if by accident someone change the SATA cable, I will screw up and overwrite new data with old data.

The only thing that I know is, that current boot disk is the good one. How I can certainly know which disk is the current boot disk (sda or sdb)?

Additional info: I've no physical access to the machine.

share|improve this question
1  
The solution would be to stop using "sda" and "sdb" and start using disk UUIDs... –  grawity Aug 28 '12 at 16:56
    
grawity is absolutely right, once you solve this you should switch to using UUIDs instead, which prevents this sort of problem. –  ChimneyImp Aug 28 '12 at 17:14
1  
Like grawity said. Those names sda and sdb are dependent on the order they are found at boot time. Usually the lower numbered port is sda. So they will change if you swap the cables. sda will then be called sdb, and vice versa. So you can't go by that name to identify them. They need a unique name... –  Keith Aug 28 '12 at 17:43
    
BTW, since you have two disks you might want to just make them RAID 1, and let the OS do the sync/copy operation for you. Then you won't have to deal with it. –  Keith Aug 28 '12 at 18:50
    
About the RAID1, yes it would be the best option but I had too much troubles to set it and gave up. –  LoThaR Aug 29 '12 at 1:56

2 Answers 2

sudo fdisk -l gets it done, and it works even if you're connected remotely. The boot partition will have an asterisk next to it.

share|improve this answer
    
The problem is the second disk is an image of the first, so both has the boot asterisk... and I still don't know which is the boot disk. –  LoThaR Aug 28 '12 at 16:40
    
Ohh. I didn't know you could even do that. –  ChimneyImp Aug 28 '12 at 17:13
awk '$2 == "/"' /proc/self/mounts
share|improve this answer
    
ese comando me devuelve: rootfs / rootfs rw 0 0 /dev/root / ext3 rw,data=ordered 0 0. ... –  LoThaR Aug 28 '12 at 17:01

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.