-   Linux - General (
-   -   Hard disk in fstab... (

kern68 11-15-2011 04:16 PM

Hard disk in fstab...
I do quite a bit of desktop and laptop repair. I will take hard disks out and plug mount them to a linux machine to backup pictures and music before reformatting.

There are two hard disks with four partitions in one of my linux machines. Partition one is swap, partition two is OS, partition three is remaining space on hard disk after swap and OS, and partition four is the second hard disk. There are entries in /etc/fstab for partitions threee and four in order to mount during boot.


/dev/sda1      /mnt/WinDisk    auto    defaults        0      0
/dev/sdb3      /mnt/TempDisk  auto    defaults        0      0

My problem arises when I plug in a third hard disk. The third hard disk may replace either partition three or four from my original setup and leave the other partition unmounted.

My question is: how can a partition be uniquely identified to force mounting before hard disks that have never been mounted to the current OS?

Thank you for any help,

syg00 11-15-2011 05:22 PM

Instead of dev name (which may change) use anything under /dev/disk/by-*
LABEL is probably most people friendly, UUID is getting to be most popular thanks to Ubuntu dictate, but by-id is most robust. UUIDs are not necessarily unique ...

kern68 11-15-2011 05:44 PM

That is cool! So the by-id references the model number and serial number of the hard disk?

Judging by the convention in /etc/fstab there would be a line starting wiht "ID=ModelNumAndSerialNum"?

Thank you very much,

syg00 11-15-2011 05:55 PM

Oops - cancel that. Probably won't work in fstab - and if it doesn't, you'll have a non-booting box.
Try UUID - if they are not copies of your disks you should be o.k.

Works fine. No "ID=" - just /dev/disk/by-id/... in place of /dev/sda?
Just tested it. I had previously only used it in mainframe environments, not "user" platforms.

Brains 11-17-2011 03:56 AM

Here's another suggestion.

I used to do the same, open the desktop case, plug a drive that either needed work or data recovery and boot up the machine, power it down when done and pull the drive out and close the case, next day, open the case again to play with another foreign drive.

Today someone came over with her daughter's old laptop and reminded me how I told her daughter a few months ago I could recover data from her non-booting laptop. Of course, a laptop has a 2.5" drive, the desktop has 5.25" drive bays, and different cable adaptors.

I bought a Bytecc USB 2.0 Drive Mate. It's an adaptor you plug 2.5",3.5",5.25" IDE or SATA drives into, then plug it into a running laptop or desktop via USB. No need to crack open the case anymore, and drives are not reasigned randomly as the unit is already running when the subject drive is plugged in, the subject drive will always be assigned the next position after the already installed permanent drives in whatever computer I use to work on the subject drive. If the subject drive is from a Mac, I can plug it into a running Mac to make things easier and faster.

I forget exacly what I paid for this adaptor, the only thing that comes to mind is how cheap it was and I wish I would have stumbled on it a lot sooner.

The only caviat, writing to a drive via USB is a little slower than through a SATA or IDE cable plugged directly to the mobo. But considering the time it takes to open the desktop case, risk frying something due to static electricity or bumping things the wrong way, I prefer using this adaptor and not have to get off my butt. Got a weak knee you know.

All times are GMT -5. The time now is 05:08 AM.