AHCI driver

Arthur Chance freebsd at qeng-ho.org
Tue Aug 10 15:39:26 UTC 2010


On 08/10/10 15:52, Roland Smith wrote:
> On Tue, Aug 10, 2010 at 03:23:29PM +0100, Arthur Chance wrote:
[snip]
>> Alternatively, before switching to the ahci driver, label all your
>> partitions and mount them using their labels rather than device names.
>
> This is probably a better idea.
>
> But people should note the difference between
> using 'tunefs -L' and 'glabel label'! The latter uses the last section of the
> provider to store metadata, so in that case one should _only_ create a
> filesystem on the labeled device!
>
>> That way the change in device names won't matter. Just be careful of the
>> gotcha with labelling the root partition.
>
> What do you mean?

Unless you're working from a fixit CD/DVD, if you're labelling an 
existing UFS root partition you have to reboot to single user mode to 
use "tunefs -L", and then have to reboot again to edit fstab to use the 
labelled device and then reboot a third time for the labelled mount to 
take effect. If you try to get clever, as I did, and omit the second 
reboot by using "mount -uw /" to make fstab editable you wipe out the 
partition label, and the final reboot fails miserably, telling you it 
can't find /dev/ufs/root (or whatever) to mount the root partition. The 
machine then goes into an cycle of rebooting and failing to find the 
root filesystem until you fix the problem.

I haven't looked at the source closely, but I'd guess this is because 
when / is mounted r/o the kernel caches a copy of its superblock, 
"tunefs -L" modifies the superblock on disk, "mount -uw /" doesn't 
reread the disk superblock (it was read only, what could possibly have 
changed? :-) so the unlabelled superblock remains cached, and the next 
reboot writes the unlabelled cached superblock over the labelled disk 
superblock on shutdown.

I was stupid enough to make this mistake twice a few months apart, so 
now instructions for labelling root partitions are part of my hard copy 
notes for when I may not have a machine working well enough to look at 
my online notes.



More information about the freebsd-questions mailing list