fstab and Grub
I grow tired of all the Label things going on in Fedora now. I wanted to let a user mount and unmount file systems since I'm the only user...I had this all working in Red Hat 9. Then I went to Fedora Core 4 and to my dismay I found that HAL was writing fstab every boot up. So you really didn't want to play with it any more.
Now on my FC6 I see that fstab and grub are not messed with by HAL any more. So I set about to make things people readable. Here is what "fdisk" finds on my two hard drives:
The number of cylinders for this disk is set to 19457. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/hdb: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/hdb1 * 1 1217 9775521 83 Linux /dev/hdb2 1218 1945 5847660 83 Linux /dev/hdb3 1946 1961 128520 82 Linux swap / Solaris /dev/hdb4 1962 19457 140536620 5 Extended /dev/hdb5 1962 7060 40957686 83 Linux /dev/hdb6 7061 12159 40957686 83 Linux /dev/hdb7 12160 18534 51207156 83 Linux
Command (m for help):
[root@localhost ~]# fdisk /dev/hda
The number of cylinders for this disk is set to 59598. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): p
Disk /dev/hda: 30.7 GB, 30758289408 bytes 16 heads, 63 sectors/track, 59598 cylinders Units = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System /dev/hda1 * 1 19524 9839781 7 HPFS/NTFS /dev/hda2 19524 20369 425722+ 82 Linux swap / Solaris /dev/hda3 20369 40689 10241437+ 5 Extended /dev/hda4 40689 59591 9526545 83 Linux /dev/hda5 20369 30537 5124703+ 83 Linux /dev/hda6 30537 40689 5116671 83 Linux
Command (m for help):
There is a lot of old linux partitions shown.
What I did then is edit fstab and grub.conf and replace the lables with actual /dev/hda1 type devices.
My original fstab looks like this:
LABEL=/1234 / ext3 defaults 1 1 devpts /dev/pts devpts gid=5,mode=620 0 0 tmpfs /dev/shm tmpfs defaults 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 LABEL=+`àQñGM@O2RÕ{ÏA swap swap defaults 0 0 LABEL=ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ swap swap defaults 0 0
The swap listings were ugly!
Here is what it looks like now:
[root@k5d ~]# more /etc/fstab /dev/hdb5 / ext3 defaults 1 1 devpts /dev/pts devpts gid=5,mode=620 0 0 tmpfs /dev/shm tmpfs defaults 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 /dev/hda2 swap swap defaults 0 0 /dev/hdb3 swap swap defaults 0 0 /dev/hdb7 /fc4 ext3 noauto, user 0 0 [root@k5d ~]#
For some reason the last line is not working right. I think maybe I need to remember what I did. Maybe a # at the first and last line.
Grub is now looking like this:
# Note that you do not have to rerun grub after making changes to this file # NOTICE: You do not have a /boot partition. This means that # all kernel and initrd paths are relative to /, eg. # root (hd1,6) # kernel /boot/vmlinuz-version ro root=/dev/hdb7 # initrd /boot/initrd-version.img #boot=/dev/hda default=0 timeout=10 splashimage=(hd1,6)/boot/grub/splash.xpm.gz hiddenmenu title Fedora Core (2.6.20-1.2962.fc6) root (hd1,4) kernel /boot/vmlinuz-2.6.20-1.2962.fc6 ro root=/dev/hdb5 rhgb quiet initrd /boot/initrd-2.6.20-1.2962.fc6.img
title Fedora Core (2.6.20-1.2952.fc6) root (hd1,4) kernel /boot/vmlinuz-2.6.20-1.2952.fc6 ro root=/dev/hdb5 rhgb quiet initrd /boot/initrd-2.6.20-1.2952.fc6.img
title Fedora Core (2.6.16-1.2111_FC4) root (hd1,6) kernel /boot/vmlinuz-2.6.16-1.2111_FC4 ro root=/dev/hdb7 rhgb quiet initrd /boot/initrd-2.6.16-1.2111_FC4.img
title Fedora Core (2.6.16-1.2108_FC4) root (hd1,6) kernel /boot/vmlinuz-2.6.16-1.2108_FC4 ro root=/dev/hdb7 rhgb quiet initrd /boot/initrd-2.6.16-1.2108_FC4.img
title Fedora Core (2.6.11-1.1369_FC4) root (hd1,1) kernel /boot/vmlinuz-2.6.11-1.1369_FC4 ro root=/dev/hdb2 rhgb quiet initrd /boot/initrd-2.6.11-1.1369_FC4.img
title Fedora Core (2.6.5-1.358) root (hd1,0) kernel /boot/vmlinuz-2.6.5-1.358 ro root=/dev/hdb1 rhgb quiet initrd /boot/initrd-2.6.5-1.358.img
title WindowsXP rootnoverify (hd0,0) chainloader +1 [root@k5d ~]#
I have rebooted with all these changes and it comes up just as well as always. Unless someone thinks this is real bad I will continue with the project.
Karl
On Wed, 2007-06-27 at 15:22 -0600, Karl Larsen wrote:
I grow tired of all the Label things going on in Fedora now.
I don't really see why it has to be worse. /dev/hda1 only means something if I always have *that* drive plugged in as the primary master. That's fairly likely, but less likely with /dev/sdc1 (if you have removeable external drives).
On the contrary, LABEL=fred/boot (where "fred" is what I've called one of my Seagate drives, and texta-written the name on the drive, itself), means that I can plug it in anywhere, and find it by that label. I don't have to figure out if it's attached at /dev/hda1, /dev/hdb1, or /dev/sdd1, and so on. Likewise, LABEL=fred-swap means that it uses that swap partition, and not the wrong one, on multi-disc systems.
Not using a multi-disc system? Well you're prepared for it in the future. You might need to plug in another drive to recover some data, and you've one less headache to sort out, *then*.
My original fstab looks like this:
LABEL=/1234 / ext3 defaults 1 1 devpts /dev/pts devpts gid=5,mode=620 0 0 tmpfs /dev/shm tmpfs defaults 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 LABEL=+`àQñGM@O2RÕ{ÏA swap swap defaults 0 0 LABEL=ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ swap swap defaults 0 0
The swap listings were ugly!
Label things yourself. Read man mkswap.
...[snip fstab and grub.conf using device names instead of labels]...
I have rebooted with all these changes and it comes up just as well
as always. Unless someone thinks this is real bad I will continue with the project.
In themselves, that's fine. I've done the same in the past. The problems you *may* come across are when you have to plug another drive in, at the same time, or plug this drive in another place.
Tim wrote:
On Wed, 2007-06-27 at 15:22 -0600, Karl Larsen wrote:
I grow tired of all the Label things going on in Fedora now.
I don't really see why it has to be worse. /dev/hda1 only means something if I always have *that* drive plugged in as the primary master. That's fairly likely, but less likely with /dev/sdc1 (if you have removeable external drives).
When I use "fdisk" to Print the drive hda and hdb and hdc... I want my label to be what it tells me.
On the contrary, LABEL=fred/boot (where "fred" is what I've called one of my Seagate drives, and texta-written the name on the drive, itself), means that I can plug it in anywhere, and find it by that label. I don't have to figure out if it's attached at /dev/hda1, /dev/hdb1, or /dev/sdd1, and so on. Likewise, LABEL=fred-swap means that it uses that swap partition, and not the wrong one, on multi-disc systems.
What can the LABEL software do to find the moved hard drive that I can't? I really do not know how it can do that. Also now days all the new drives are via USB.
Not using a multi-disc system? Well you're prepared for it in the future. You might need to plug in another drive to recover some data, and you've one less headache to sort out, *then*.
My original fstab looks like this:
LABEL=/1234 / ext3 defaults 1 1 devpts /dev/pts devpts gid=5,mode=620 0 0 tmpfs /dev/shm tmpfs defaults 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 LABEL=+`àQñGM@O2RÕ{ÏA swap swap defaults 0 0 LABEL=ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ swap swap defaults 0 0
The swap listings were ugly!
Label things yourself. Read man mkswap.
I will read man mkswap and hold things open until I understand that... :-)
...[snip fstab and grub.conf using device names instead of labels]...
I have rebooted with all these changes and it comes up just as well
as always. Unless someone thinks this is real bad I will continue with the project.
In themselves, that's fine. I've done the same in the past. The problems you *may* come across are when you have to plug another drive in, at the same time, or plug this drive in another place.
Karl
On Thu, 2007-06-28 at 06:23 -0600, Karl Larsen wrote:
When I use "fdisk" to Print the drive hda and hdb and hdc... I want
my label to be what it tells me.
...[snip]...
What can the LABEL software do to find the moved hard drive that I
can't? I really do not know how it can do that. Also now days all the new drives are via USB.
Answering them in one go. It's the computer, not you. When you label partitions in a certain way, you don't have to go hunting around to find them. You don't have to play with fdisk, you don't have to scratch your head to figure out what to put in fdisk.
Here's how one of my drive (called max) layouts is set up:
Current device Volume label Mount point location
/dev/sda1 max/boot /boot /dev/sda2 max/home /home /dev/sda3 max/var /var /dev/sda5 max/usr /usr /dev/sda6 max/tmp /tmp /dev/sda7 max-swap swap /dev/sda8 max/ /
Now, depending on what's plugged in where, this drive may be /dev/sda it may not. If I'd used device-based mounting points, and it was connected so it's no longer /dev/sda, I'd have to change fstab entries. But if I used labels, the computer sorts that out for me. My fstab files have no /dev type of entries.
If I want to manually mount my home partition somewhere, I don't have to figure out where it is, I can just refer to it as max/home and mount it where I like.
e.g. mount -L max/home /home
Likewise for any other partitions.
If I rip the max drive out to pull files from it on another Linux installation, it's easy.
Firstly, all my drive partitions have unique labels (so there'll be no mount point clashes, the other drive will have fred/home, fred/root, etc, it's differently named). Try and put in two drives with a partition labelled "/home" and you're in for grief. And the installer malarkey of avoiding duplicates by calling things /boot1, /boot2, /, and /1, is far from ideal.
Secondly, I don't have to care where it is. I can "mount -L max/home /mnt" and pull files off, or fix things, or whatever.
Let the computer do the grunt work of finding where your partitions are, automatically. It's almost a given that at some point users might have to connect two drives to one box to resolve an issue. It's less mental gymnastics if the system works in a clearly coherent and predictable manner.