Every now and then I encounter a server that have multiple external drives attached to it. When the server is rebooted – let’s say we just updated the kernel – it sometimes happens that the external drives don’t get assigned the same device numbers they had before. This, in turn, means that we can’t mount them the old way, i.e. by device number, via /etc/fstab.
Fortunately, there are alternative ways of doing this. Let’s start by finding out the filesytem ID.
For ext2/3/4, do:
# dumpe2fs /dev/sdb1 | grep UUID
dumpe2fs 1.39 (29-May-2006)
Filesystem UUID: 5fbb68f9-86af-4784-bdb3-3ab452a5f263
For reiserfs, do:
# debugreiserfs /dev/sdc1 | grep UUID
debugreiserfs 3.6.21 (2009 www.namesys.com)
UUID: aa3c3244-83c2-491e-bab5-067c5e73ce9c
For xfs, do:
# xfs_admin -u /dev/sdc1
UUID = 0d4139ef-db18-417c-8dc0-273f94acfa3a
JFS, as far as I can tell, does not automatically generate a UUID when you create the filesystem. You have to do it.
# jfs_tune -U random /dev/sdc1 jfs_tune version 1.1.12, 24-Aug-2007 UUID updated successfully.
Now, to view the UUID, do:
# jfs_tune -l /dev/sdc1 | grep UUID
File system UUID: cab1b11d-1f09-4dc6-aec8-b84537ff895f
External log UUID: b02579b7-0100-0000-0000-000001000000
Now, adjust your /etc/fstab:
#/dev/sdc1 /backup ext3 defaults 0 0
UUID=b7bcf64a-e172-42ce-8ce7-12365cc72c6c /backup ext3 defaults 0 0
This will ensure that each filesystem is mounted in the right place, even if the device names come up in the wrong order.
« Asus EeePC 1201N replacement wireless card Removing Microsoft Office 2011 »