On Mon, Jun 21, 2010 at 4:50 AM, Scott Long <scottl_at_samsco.org> wrote: > I just set up a machine with the following GPT scheme: > > => 34 5853511613 mfid0 GPT (2.7T) > 34 128 1 freebsd-boot (64K) > 162 862 - free - (431K) > 1024 2097152 2 freebsd-ufs (1.0G) > 2098176 4194304 3 freebsd-swap (2.0G) > 6292480 2097152 4 freebsd-ufs (1.0G) > 8389632 104857600 5 freebsd-ufs (50G) > 113247232 5740264414 6 freebsd-ufs (2.7T) > 5853511646 1 - free - (512B) > > After the first partition, I created a deliberate gap for alignment, reflected in the second line. The third line shows a starting offset of sector 1024, which is 512KB. This should be a good generic start point for most RAID geometries with a stripe size <= 512KB. The rest are normal /, swap, /var, /usr and /opt partitions. The single free sector on the final line is probably a calculation error on my part, there's no particular reason for it. > > The gpart man page has good descriptions on how to create partitions and make the GPT scheme bootable. It's not very automated, you'll need to have a calculator handy, but it works. I scripted this as part of our custom installer - it uses the same 1MB offset that Vista/Win7 do which should align for anything with a <= 1MB stripe size: # Device to partition diskdev="/dev/da0" # First partition offset in 512-byte sectors. This should be aligned with # any RAID stripe size for maximum performance. 2048 aligns the partition # start boundary at the 1MiB, consistent with Vista/Windows 7. This should # match all common stripe sizes such as 64kb, 128kb and 256kb. root_offset="2048" # Boot partition offset. This sits just before our first root partition and # stores the boot loader which is used to load the OS. boot_offset="2032" # Initialise the disk with a GPT partition table gpart create -s gpt $diskdev # # System disk partitioning layout # gpart add -l boot -t freebsd-boot -s 16 -b $boot_offset $diskdev # boot p1 gpart add -l root -t freebsd-ufs -s 2G -b $root_offset $diskdev # / p2 gpart add -l swap -t freebsd-swap -s 4G $diskdev # swap p3 gpart add -l var -t freebsd-ufs -s 4G $diskdev # /var p4 gpart add -l usr -t freebsd-ufs $diskdev # /usr p5 # Install the gpt boot code (pmbr into the PMBR, gptboot into our boot partition p1) gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 $diskdev # Make the first partition active # (required for older BIOSes to boot from the GPT PMBR) echo 'a 1' | fdisk -f - $diskdev gpart is smart enough to figure out most of the math for you these days... -- AntonyReceived on Sun Jun 20 2010 - 18:59:05 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:04 UTC