LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-15-2011, 04:16 PM   #1
kern68
Member
 
Registered: Jun 2010
Distribution: Fedora, Ubuntu, CentOS, OpenSUSE
Posts: 47

Rep: Reputation: 0
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.

Code:
/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,
GeoK
 
Old 11-15-2011, 05:22 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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 ...
 
1 members found this post helpful.
Old 11-15-2011, 05:44 PM   #3
kern68
Member
 
Registered: Jun 2010
Distribution: Fedora, Ubuntu, CentOS, OpenSUSE
Posts: 47

Original Poster
Rep: Reputation: 0
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,
GeoK
 
Old 11-15-2011, 05:55 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
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.

Last edited by syg00; 11-15-2011 at 06:12 PM.
 
1 members found this post helpful.
Old 11-17-2011, 03:56 AM   #5
Brains
Senior Member
 
Registered: Apr 2009
Distribution: All OS except Apple
Posts: 1,591

Rep: Reputation: 389Reputation: 389Reputation: 389Reputation: 389
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.

Last edited by Brains; 11-17-2011 at 04:06 AM. Reason: Corrected laptop drive size
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with a new Hard Disk and fstab baldur2630 Linux - Server 5 10-04-2011 02:53 AM
[SOLVED] fstab entry to mount second Hard disk. flatstan SUSE / openSUSE 5 02-11-2010 07:10 AM
USB external hard disk and fstab sblantipodi Linux - General 8 01-06-2008 01:14 PM
what entries to put into fstab for new hard disk? chuck_notorious Linux - Hardware 1 04-21-2004 03:37 AM
Mounting hard disk through fstab aiims1777 Linux - Newbie 5 11-05-2003 05:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration