From owner-freebsd-fs@FreeBSD.ORG Sun Mar 10 22:57:36 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 51B4A24F for ; Sun, 10 Mar 2013 22:57:36 +0000 (UTC) (envelope-from nowakpl@platinum.linux.pl) Received: from platinum.linux.pl (platinum.edu.pl [81.161.192.4]) by mx1.freebsd.org (Postfix) with ESMTP id EE51865A for ; Sun, 10 Mar 2013 22:57:35 +0000 (UTC) Received: by platinum.linux.pl (Postfix, from userid 87) id A3FCA47E1D; Sun, 10 Mar 2013 23:52:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on platinum.linux.pl X-Spam-Level: X-Spam-Status: No, score=-1.3 required=3.0 tests=ALL_TRUSTED,AWL autolearn=disabled version=3.3.2 Received: from [10.255.1.2] (unknown [83.151.38.73]) by platinum.linux.pl (Postfix) with ESMTPA id 09DEB47E11 for ; Sun, 10 Mar 2013 23:52:22 +0100 (CET) Message-ID: <513D0E90.5090105@platinum.linux.pl> Date: Sun, 10 Mar 2013 23:52:00 +0100 From: Adam Nowacki User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: freebsd-fs@freebsd.org Subject: Re: Aligning MBR for ZFS boot help References: <513C1629.50501@caltel.com> In-Reply-To: <513C1629.50501@caltel.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Mar 2013 22:57:36 -0000 I don't think zfsboot is aware of BSD disklabel (offsets other than 0 won't boot). Is there any reason you are using BSD disklabel and not two partition MBR? I also don't think there is any merit in aligning to 1MiB. Most ZFS IOs will be aligned to sector size (ashift). Unless ZFS pool is created with higher ashift then the 63 sector offset is as good as any. gpart create -s mbr ada0 gpart add -s 52862M -t freebsd ada0 gpart add -s 8G -t freebsd ada0 gpart bootcode -b /boot/mbr ada0 dd if=/boot/zfsboot of=/dev/ada0s1 count=1 dd if=/boot/zfsboot of=/dev/ada0s1 skip=1 seek=1024 zpool create ... /dev/ada0s1 swapon /dev/ada0s2 If you still want that 1MB alignment then you will have to (as explained by others) align the MBR partition. On 2013-03-10 06:12, Cody Ritts wrote: > 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 > _______________________________________________ > freebsd-fs@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-fs > To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org"