Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Nov 2012 09:36:22 -0800
From:      freebsd@johnea.net
To:        freebsd-questions@freebsd.org
Subject:   Should newfs include -S 4096? was Re: boot problem after freebsd-update from 9.1-RC2 to 9.1-RC3
Message-ID:  <50AFB42F.2000805@johnea.net>
In-Reply-To: <alpine.BSF.2.00.1211202201460.42121@wonkity.com>
References:  <50ABE97B.5030408@johnea.net> <50AC041A.7050607@dreamchaser.org> <50AC3116.6010600@johnea.net> <alpine.BSF.2.00.1211202201460.42121@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2012-11-20 21:10, Warren Block wrote:
> On Tue, 20 Nov 2012, freebsd@johnea.net wrote:
> 
>> On 2012-11-20 14:28, Gary Aitken wrote:
>>> On 11/20/12 13:34, freebsd@johnea.net wrote:
>>
>>>> freebsd-update upgrade -r 9.1-RC3
>> ...
>>>> "Not UFS"  "No ada0" "No boot"
>>
>>>
>>> Seems like it isn't supposed to work for 9.1-RC2
>>>
>>
>> I previously used binary update to migrate from 9.0 to 9.1, via:
>>
>> freebsd-update upgrade -r 9.1-RC1
>> freebsd-update install
>> reboot
>> freebsd-update install
>> reboot
>>
>> I'm starting to think having the swap partition in gm0s1a and the booting UFS partition in ada0s1b is the problem:
>> http://forums.freebsd.org/showthread.php?t=31954
>>
>> The "Not UFS" error comes immediately on boot.
>>
>> If I boot from rescue media, I can start the gmirror, mount it and chroot into it.
>>
>> The whole install seems fine except for the first stage boot loader finding the UFS partition.
>>
>> A handy bootloader config trick would be greatly appreciated!
> 
> boot(8) says
> 
>   The automatic boot will attempt to load /boot/loader from partition
>   `a' of either the floppy or the hard disk.
> 
> You could try setting the correct device path in /boot/boot.config, but I suspect that won't be read until too late.
> 
> gptboot looks for the first UFS partition.  Maybe /boot/boot can be modified to do that also.

I ended up booting from rescue media, removing one drive and stopping the gmirror, creating a new gmirror on the removed drive to place the UFS partition first, and performing a dump/restore to transfer the system. Then I was able to boot from the new gmitrror and add the second drive to it.

One of the complications was getting old metadata off of the drive. After trying a couple of 'dd' invocations:
# overwriting the first sector
dd if=/dev/zero of=/dev/ada0 bs=512 count=1
# also tried overwriting the last sector
diskinfo ada0 | cut -f4
3907029168
(subtract 34, per WB) (I actually just subtracted the trailing 68)
dd if=/dev/zero of=/dev/ada0 seek=3907029100

This would still seem to not delete all of the metadata, since after issuing:

gmirror label -b split gm0 /dev/ada0
gmirror load
# repartition new mirror
gpart create -s MBR mirror/gm0
# ignore "mirror/gm0s1 added, but partition is not aligned on 4096 bytes" after add
gpart add -t freebsd -a 4k mirror/gm0
# create the bsdlabel partitions in slice 1 (s1)
gpart create -s BSD mirror/gm0s1

I would see that the old gm0s1a and gm0s1b had reappeared, even though I had not yet issued the 'add -t freebsd-ufs'. I'm not sure if they came back with the 'add -t freebsd' or the 'create -s BSD'. 

The only thing that seemed to fix it was:

gpart destroy -F /dev/ada0

I also tried at one point:

gpart destroy -F ada0
gpart create -s gpt ada0
gpart destroy -F ada0

After that I could create the new partitions within the slice, with freebsd-ufs first:

# size of ufs partition must be calculated, from 'diskinfo -v /dev/ada0':
2000398934016 # media size in bytes (1.8T)
; 1024*1024*1024
        1073741824
; 2000398934016/1073741824
        1863.01668548583984375
# subtract 8G from 1863 = 1855G
gpart add -t freebsd-ufs -a 4k -s 1855G mirror/gm0s1
gpart add -t freebsd-swap -a 4k mirror/gm0s1

Everything looks good with 4K alignment, and freebsd-ufs first:

gpart show
=>        63  3907029104  mirror/gm0  MBR  (1.8T)
          63          63              - free -  (31k)
         126  3907028979           1  freebsd  [active]  (1.8T)
  3907029105          62              - free -  (31k)

=>         0  3907028979  mirror/gm0s1  BSD  (1.8T)
           0           2                - free -  (1.0k)
           2  3890216960             1  freebsd-ufs  (1.8T)
  3890216962    16812016             2  freebsd-swap  (8.0G)
  3907028978           1                - free -  (512B)

After newfs, I was able to dump/restore to transfer the installed system from ada1 to gm0 (which is 9.1-RC3 now).

The thing I wonder about now: Should newfs include -S 4096?

I used:

newfs -U /dev/mirror/gm0s1a

Will this lead to 512 byte sector access to the disk through the file system?

Will this impact performance or longevity of the mirror?

Thanks again for the sage advice!

johnea



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50AFB42F.2000805>