From owner-freebsd-fs@FreeBSD.ORG Wed Nov 19 07:06:59 2014 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B25CED41 for ; Wed, 19 Nov 2014 07:06:59 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0088.outbound.protection.outlook.com [157.56.110.88]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 53D17844 for ; Wed, 19 Nov 2014 07:06:58 +0000 (UTC) Received: from DM2PR0801MB0944.namprd08.prod.outlook.com (25.160.131.27) by DM2PR0801MB0942.namprd08.prod.outlook.com (25.160.131.25) with Microsoft SMTP Server (TLS) id 15.1.16.15; Wed, 19 Nov 2014 07:06:49 +0000 Received: from DM2PR0801MB0944.namprd08.prod.outlook.com ([25.160.131.27]) by DM2PR0801MB0944.namprd08.prod.outlook.com ([25.160.131.27]) with mapi id 15.01.0016.006; Wed, 19 Nov 2014 07:06:49 +0000 From: "Pokala, Ravi" To: "borjam@sarenet.es" , "freebsd-fs@freebsd.org" Subject: Re: BIOS booting from disks > 2TB Thread-Topic: BIOS booting from disks > 2TB Thread-Index: AQHQA8djh8Fld4MMbk2TOr3Zp8LvCg== Date: Wed, 19 Nov 2014 07:06:49 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.4.6.141106 x-originating-ip: [24.6.178.251] x-microsoft-antispam: BCL:0;PCL:0;RULEID:;SRVR:DM2PR0801MB0942; x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:; SRVR:DM2PR0801MB0942; x-forefront-prvs: 04004D94E2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(122556002)(83506001)(36756003)(40100003)(97736003)(2656002)(92566001)(86362001)(66066001)(92726001)(4396001)(87936001)(64706001)(106356001)(20776003)(2501002)(21056001)(106116001)(105586002)(77096003)(77156002)(62966003)(95666004)(99396003)(99286002)(46102003)(120916001)(50986999)(54356999)(107886001)(101416001)(31966008)(107046002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0801MB0942; H:DM2PR0801MB0944.namprd08.prod.outlook.com; FPR:; MLV:sfv; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: panasas.com X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Nov 2014 07:06:59 -0000 Hi Borja, I'd like to clarify something important - you don't need to boot using UEFI to use GPT for partitioning. You *do* need to use GPT to have partitions larger than 2^32 sectors (2TiB for drives w/ 512B sectors, or 16TiB for drives w/ 4KB sectors). When you perform your installation, just make sure to select the GPT option for partitioning. The installer (either `bsdinstall' (for stock FreeBSD), or `pc-sysinstall' (for PC-BSD / FreeNAS)) should create both primary (near start-of-disk) and backup (at end-of-disk) GPT tables, and install the appropriate bootstrap code in the proper locations. Hope that helps, Ravi -------- Details, for those who are interested: The firmware reads LBA 0 to find the Master Boot Record (MBR). In both cases: - the first 446 bytes are executable code - the next 64 bytes are the slice table - the last 2 bytes are the MBR signature ---- In the slice/label partitioning scheme (some of the details might be slightly off, but the big picture is right): - the 446-byte executable code [mbr.s] reads the slice table, finds the first-stage bootloader [boot0.S], and executes it - the first-stage bootloader finds the second-stage bootloader [boot1.S], and executes it - the second-stage bootloader reads the disklabel, finds the third-stage bootloader [boot2.c], and executes it - the third-stage bootloader reads the UFS filesystem, finds the `loader' binary, and executes it ---- In the case of GPT, the slice-table portion of the MBR contains a single slice entry which covers the whole disk. This protects a non-GPT-aware slicer from trying to add slices. For this reason, it is referred to as the Protective MBR (PMBR). In the GPT scheme (I'm more confident about this): - the 446-byte executable code [pmbr.s] finds the GPT Header - based on the GPT Header, the PMBR finds the GPT Table - based on the GPT Table, the PMBR finds the GPT bootstrap [gptldr.S, gptboot.c], and executes it - the GPT bootstrap reads the UFS filesystem, finds the `loader' binary, and executes it Note that, by not having to find and parse a separate disklabel in addition to a partition table, the GPT bootstrap actually has fewer stages. -------- Source, for those who are *really* interested: [mbr.s] - sys/boot/i386/mbr [boot0.S] - sys/boot/i386/boot0 [boot1.S] - sys/boot/i386/boot2 # Yes, boot1 is in the boot2 directory [boot2.c] - sys/boot/i386/boot2 [pmbr.s] - sys/boot/i386/pmbr [gptldr.S, gptboot.c] - sys/boot/i386/gptboot --rpokala