Partitions created by the Auto option of bsdinstall's partition editor do not start on even 4K boundaries. This will seriously compromise performance on drives with 4K-byte blocks. gpart show ada0 => 34 25694141 ada0 GPT (12G) 34 128 1 freebsd-boot (64k) 162 23068544 2 freebsd-ufs (11G) 23068706 1284096 3 freebsd-swap (627M) 24352802 1341373 - free - (655M) Partition 2 starts at block 162. Instead, it should start at 1M as with gpart add -t freebsd-ufs -b 1M -s 11G ada0 Note: at present, FreeBSD boot code fails when freebsd-boot partitions are larger than 512K, so making the freebsd-boot partition 1M is not the simple fix it appears to be. Reported by je33 in http://forums.freebsd.org/showthread.php?t=27044 Fix: FreeBSD partition types other than freebsd-boot should start at the next even multiple of 1M for good performance on Advanced Format (4K block) drives without harming performance of 512 byte drives. How-To-Repeat: Install FreeBSD 9.0-BETA3 with bsdinstall and Auto partitioning.
Responsible Changed From-To: freebsd-bugs->freebsd-sysinstall over to maintainer
While I agree with you in need of aligning [first] partition, I'd like to behold, that gpart show size in blocks, not in megabytes, so to align partition to 1 mbyte on 4K-align HDDs you might execute "gpart add -b 2048 -s 64K -t freebsd-boot ada0" ( 2048 blocks * 4096 kbytes = 8 Mbyte, in case of "plain" HDD 2048 blocks * 512 bytes = 1 Mbyte, which, I think, is a pretty good). Moreover, I don't see why freebsd-boot partition should be more than 512K, if even 64K are currently just enough for FreeBSD. Looks like old and famous Bill Gates's sentence, I know, but however :) -- With best regards, Dennis Yusupoff, network engineer of Smart-Telecom ISP Russia, Saint-Petersburg
On Tue, 25 Oct 2011, Dennis Yusupoff wrote: > While I agree with you in need of aligning [first] partition, I'd like > to behold, that gpart show size in blocks, not in megabytes, so to align > partition to 1 mbyte on 4K-align HDDs you might execute "gpart add -b > 2048 -s 64K -t freebsd-boot ada0" ( 2048 blocks * 4096 kbytes = 8 Mbyte, > in case of "plain" HDD 2048 blocks * 512 bytes = 1 Mbyte, which, I > think, is a pretty good). The -b option to 'gpart add' also accepts a size like "1M", so 'gpart add -t freebsd-ufs -b 1M ...' should work on any drive with a block size all the way up to 1M. Tested and works on 512-byte drives, but I have not tested it on a 4K drive. There's also the -a option, which attempts to align partitions to the value given. '-a 4096' should work on both 512-byte and 4k-byte drives. (bsdinstall's partition editor and wizard do not run gpart(8) but make lower-level calls to libgeom. Still, the functionality of the -a or -b options could be duplicated.) > Moreover, I don't see why freebsd-boot partition should be more than > 512K, if even 64K are currently just enough for FreeBSD. Looks like old > and famous Bill Gates's sentence, I know, but however :) FreeBSD bootcode has problems with a freebsd-boot partition larger than 512K, so that's the current limit. However, starting the first filesystem partition at 1M works for both alignment and compatibility with other systems. From the -current mailing list: http://lists.freebsd.org/pipermail/freebsd-current/2011-September/027547.html http://lists.freebsd.org/pipermail/freebsd-current/2011-September/027548.html http://lists.freebsd.org/pipermail/freebsd-current/2011-September/027550.html http://lists.freebsd.org/pipermail/freebsd-current/2011-September/027563.html http://lists.freebsd.org/pipermail/freebsd-current/2011-September/027626.html
25.10.2011 17:17, Warren Block пиÑеÑ: > > The -b option to 'gpart add' also accepts a size like "1M", so 'gpart > add -t freebsd-ufs -b 1M ...' should work on any drive with a block > size all the way up to 1M. Tested and works on 512-byte drives, but I > have not tested it on a 4K drive. > > There's also the -a option, which attempts to align partitions to the > value given. '-a 4096' should work on both 512-byte and 4k-byte drives. I haven't knew it, thanks. > >> Moreover, I don't see why freebsd-boot partition should be more than >> 512K, if even 64K are currently just enough for FreeBSD. Looks like old >> and famous Bill Gates's sentence, I know, but however :) > > FreeBSD bootcode has problems with a freebsd-boot partition larger > than 512K, so that's the current limit. > > However, starting the first filesystem partition at 1M works for both > alignment and compatibility with other systems. From the -current > mailing list: > [...skipped...] Yeah, I agree with you, but aligning shift size hasn't relation with partition size - so works with aligned partition doesn't need to increase freebsd-boot partition larger 512K since it's work. P.S. My home server: === [dyr@server ~]$ gpart show ada0 => 34 3907029101 ada0 GPT (1.8T) 34 2014 - free - (1M) 2048 128 1 freebsd-boot (64k) 2176 8388608 2 freebsd-swap (4.0G) 8390784 41943040 3 freebsd-zfs (20G) 50333824 3856695311 4 freebsd-zfs (1.8T) [dyr@server ~]$ === Works fine... -- With best regards, Dennis Yusupoff, network engineer of Smart-Telecom ISP Russia, Saint-Petersburg
The installer aligns to the physical block (or RAID stripe) size reported by the kernel for the device being formatted. For 4K disks, it aligns at 4K. For 512-byte disks (as in the example here, I think), it aligns at 512 bytes.
I think would be quite safe to default to 4k alignment on GPT partitioned disks, this would not break anything. On MBR disks it's not possible because some old BIOSes still insist on the CHS geometry alignment and might not work with 4k aligned partitions. How about getting this fixed as an errata fix for 10.1?
It would be easy enough to change, but is unnecessary for disks with 512 byte sectors, which are the only ones affected. Since there isn't any bug, there is no need to change anything.