Date: Sat, 09 Mar 2013 21:12:09 -0800 From: Cody Ritts <cr@caltel.com> To: freebsd-fs@freebsd.org Subject: Aligning MBR for ZFS boot help Message-ID: <513C1629.50501@caltel.com>
next in thread | raw e-mail | index | archive | help
Hello all, I am really struggling to understand what is going on, if anyone could tell me where I am going wrong, I would greatly appreciate it. I have a new intel atom appliance that will not boot from a GPT partition table. It came with an SSD, so I am trying to align it to 1MB for the erase block size. All of these commands are being run from a 9.1-RELEASE-amd64-memstick These commands partition the drive, the system boots just fine: > gpart create -s mbr ada0 > gpart add -t freebsd ada0 > gpart create -s bsd ada0s1 > gpart add -s 52862M -t freebsd-zfs ada0s1 > gpart add -s 8G -t freebsd-swap ada0s1 > gpart set -a active -i 1 ada0 > gpart bootcode -b /boot/mbr ada0 > dd if=/boot/zfsboot of=/dev/ada0s1 count=1 > dd if=/boot/zfsboot of=/dev/ada0s1a skip=1 seek=1024 This is the gpart print output of those commands > => 63 125045361 ada0 MBR (59G) > 63 125045361 1 freebsd [active] (59G) > > => 0 125045361 ada0s1 BSD (59G) > 0 108261376 1 freebsd-zfs (51G) > 108261376 16777216 2 freebsd-swap (8.0G) > 125038592 6769 - free - (3.3M) Here is my disk info > root@:/root # diskinfo -v ada0 > ada0 > 512 # sectorsize > 64023257088 # mediasize in bytes (59G) > 125045424 # mediasize in sectors > 0 # stripesize > 0 # stripeoffset > 124053 # Cylinders according to firmware. > 16 # Heads according to firmware. > 63 # Sectors according to firmware. 125045361 + 63 = 125045424 So gpart is for sure printing sectors. freebsd-zfs starts at sector 63 So, I need that freebsd-zfs slice to start at 1MB 1MB = 2048s 2048 - 63 = 1985 so if I add an offset to my slice: > gpart add -b 1985 -s 52862M -t freebsd-zfs ada0s1 should start me at 2048. > => 63 125045361 ada0 MBR (59G) > 63 125045361 1 freebsd [active] (59G) > => 0 125045361 ada0s1 BSD (59G) > 0 1985 - free - (992k) > 1985 108261376 1 freebsd-zfs (51G) BUT, when i boot, I get this: > zfsboot: No ZFS Pools located, can't boot I think remember reading that freebsd-zfs had to be the first slice (I cannot remember where i read that). And it apparently does not think an offset is funny. So, that leaves me with trying to adjust my MBR partition, so I start over and run: > gpart add -b 1985 -t freebsd ada0 but that gives me: > => 63 125045361 ada0 MBR (59G) > 63 1953 - free - (976k) > 2016 125043408 1 freebsd (59G) HHHMMMMM???? well, 2016 - 1953 = 63 coincidence? i doubt it, but I dont get it. Poking around on the internet, it looks like gpart is possibly enforcing geometry boundaries? so I do the following: > sysctl kern.geom.part.check_integrity=0 > root@:/root # gpart add -a 1m -t freebsd ada0 > ada0s1 added > root@:/root # gpart show > => 63 125045361 ada0 MBR (59G) > 63 2016 - free - (1M) > 2079 125042652 1 freebsd (59G) > 125044731 693 - free - (346k) Obviously still didnt work. I try a 10MB offset. 10MB = 20480s 20480-63 = 20417s > gpart add -b 20417 -t freebsd ada0 > => 63 125045361 ada0 MBR (59G) > 63 20412 - free - (10M) > 20475 125024949 1 freebsd (59G) It is still just a few sectors off. So what if i let gpart automatically align it. > gpart add -a 1m -t freebsd ada0 > => 63 125045361 ada0 MBR (59G) > 63 2016 - free - (1M) > 2079 125042652 1 freebsd (59G) > 125044731 693 - free - (346k) And 2079 is still != 2048. I have tried adjusting those numbers one by one, and it just hops around the number I am looking for. I have tried adding partitions in-front of it, setting the alignment to 1s, and adjusting the size. I cannot get it to land on 2048. It does boot with the padding in the MBR table, but I don't think it is aligned. Maybe it is aligned, and I just dont know any better. I am at a loss. Any suggestions would be greatly appreciated. Thanks, Cody
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?513C1629.50501>