[Durham] fstab and mounting drives at boot

Richard Mortimer richm at oldelvet.org.uk
Mon Aug 4 21:24:10 UTC 2014


Hi,

On 04/08/2014 21:25, Andrew Glass wrote:
> Hey guys
>
> Something weird is happening with my debian server.
>
> Ive got a hp microserver N54L and Ive popped a 500gb, 1tb. 1.5tb and 2tb
> hard drive in it.  Ive installed the OS to the 500gig however once I
> popped the other drives in and mounted them via fstab.  On one reboot
> they will mount correctly then on the next reboot the boot drive will
> move from /dev/sda to /dev/sdd..
In general the device names are not guaranteed to be fixed on modern 
systems. Hotplug, USB, parallel device driver loading all mean that 
devices are loaded in different orders on different boots.

> Its driving me potty, Did installing
> the OS before I popped the extra drives in make a difference to this?
Nope.

>
> Is there anything I can do to solve this issue?
Yes. You should find all your partitions are listed in
/dev/disk/by-uuid/

richm at bishop:~$ ls /dev/disk/by-uuid/
19c3ae0c-408b-4d82-a19c-5d2a67d917a6
8a492ed6-5af5-4033-a8d1-20bb72cb32f0
22447c80-6dd9-4c55-906b-fbf609f9b807
93a9702b-8aed-43e9-a76d-1ec4c39714d4

These UUIDs are the UUIDs of the filesystems on each partition.

You can use the UUIDs in /etc/fstab instead of the device name.

UUID=19c3ae0c-408b-4d82-a19c-5d2a67d917a6 /mnt/tmp1      ext3 
defaults,ro,noatime      0       2

There are various techniques to work out what UUID is on each partition 
but assuming that you have the filesystems already mounted by /dev/xxx 
then look at what the /dev/disk/by-uuid link points to

richm at bishop:~$ ls -l /dev/disk/by-uuid/19c3ae0c-408b-4d82-a19c-5d2a67d917a6
lrwxrwxrwx 1 root root 11 Jul  1 16:21 
/dev/disk/by-uuid/19c3ae0c-408b-4d82-a19c-5d2a67d917a6 -> ../../dm-12

In my case this particular one points to a LVM partition but you should 
be able to work it out quite easily.

Alternatively use tune2fs -l to list the properties of the partition and 
that will show you the filesystem UUID (useful when setting up new 
partitions)

richm at bishop:~$ sudo tune2fs -l /dev/dm-12
tune2fs 1.42.9 (4-Feb-2014)
Filesystem volume name:   <none>
Last mounted on:          <not available>
Filesystem UUID:          19c3ae0c-408b-4d82-a19c-5d2a67d917a6
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
...

That should get you fixed up.

Richard

>
> I was previously running ubuntu on the server but that was installed
> onto the internal usb pen and it ran fine.  I only popped the 500gb
> drive in on the extra sata port on the board as usb was a tad slow.
>
> Cheers
>
> Andy
>
>
> _______________________________________________
> Durham mailing list   -   Durham at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/durham
> http://www.nelug.org.uk/
>



More information about the Durham mailing list