Summary: | bsdinstall(8) does not align partitions at 4k (or more) | ||
---|---|---|---|
Product: | Base System | Reporter: | Mark.Martinec |
Component: | bin | Assignee: | Allan Jude <allanjude> |
Status: | Closed FIXED | ||
Severity: | Affects Some People | CC: | allanjude, dron_2, dteske, emaste, meyer.sydney, petrek729, pi, quickfox, re, timp87, will |
Priority: | --- | ||
Version: | 10.1-RELEASE | ||
Hardware: | Any | ||
OS: | Any |
Description
Mark.Martinec
2014-11-19 19:08:05 UTC
I have the same problem, what's more, with this setting the swap partition is not configured correctly, after rebooting the installer, swapon fails complaining it can't find ada0p2 at all although "gpart show" confirms it's where it should be. Swap works with auto partitioning if No for 4K is set. The code for handling 4K alignment was changed recently (4 days ago in stable/10; 6 weeks ago in head). Can you please try the following snapshot(s) and get back to us? >>> 10.1-STABLE http://svnweb.freebsd.org/base?view=revision&revision=278027 CD/DVD: http://ftp.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/10.1/FreeBSD-10.1-STABLE-amd64-20150201-r278028-disc1.iso USB: http://ftp.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/10.1/FreeBSD-10.1-STABLE-amd64-20150201-r278028-memstick.img >>> 11.0-CURRENT http://svnweb.freebsd.org/base?view=revision&revision=276027 CD/DVD: http://ftp.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/11.0/FreeBSD-11.0-CURRENT-amd64-20150201-r278031-disc1.iso USB: http://ftp.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/11.0/FreeBSD-11.0-CURRENT-amd64-20150201-r278031-memstick.img (In reply to Devin Teske from comment #2) The change to vfs.zfs.min_auto_ashift=12 only affects ZFS (it is the replacement for gnop), it does not change the actual partition alignment (controlled with the -a flag when using gpart add) the zfsboot code will need to be modified to use -a 4k or -a 1m when creating the non-boot partitions. I am not sure what the correct way to handle this is for MBR though. There is even a thread on forum. https://forums.freebsd.org/threads/freebsd-10-failed-installing-on-zfs-root.45049/ Any chance of fixing installer's gpart partition alignment problem in time for 10.2 ? It should do something like: gpart add -t freebsd-boot -a 512k -s 512k da0 gpart add -t freebsd-swap -a 1m -s 2g da0 gpart add -t freebsd-zfs -a 1m da0 (In reply to Mark.Martinec from comment #5) Why 1m? I hope it will be fixed before 10.2, but I think it won't 1m for the 4k alignment in any corner case, as far as I understand. The only waste when aligning the boot partition at 512k (1024 blocks) instead of 4k (40 blocks) is 492 kilobytes wasted. All partitions that follow will be 1M aligned with no waste (assuming boot partition is 512kB in size, which seems to be a recommended size nowadays). I think that we are way past the times where one would care for a wasted 0.48 MB on a disk (1024-40)*512./1024/1024. Those that build appliances on microcontrollers have other worries anyway and do not care for bsdinstall. 1MB alignment is beneficial for SSD devices, some of which do not care to report physical sector size. Consider also tiny computers that run off an SD card or USB key. And 0.48 MB wasted on a spinning disk seems like a non-issue to me. Even Microsoft is now aligning all partitions at 1MB, regardless of the underlying media (according to Wikipedia). ping'ed to re to fix for 10.2-REL (In reply to petrek729 from comment #1) The swap issue was an unrelated bug having to do with geom_label's disk_ident type stealing the device and not making it accessible via the gpt label. It was fixed here: https://svnweb.freebsd.org/base?view=revision&revision=r266107 By using /dev/$disk$swappart instead of /dev/gpt/swap$index I have created a patch to align to 4k for the boot partition (not really necessary) and 1mb for the swap/zfs partitions. I am slightly concerned about aligning MBR to 4k, because of the way the bootloader is stuffed into the partition. Aligning the partitions caused the machine to not boot correctly, however aligning the BSD partition table inside the MBR first, seems to work. The patch is currently awaiting review: https://reviews.freebsd.org/D3062 A commit references this bug: Author: allanjude Date: Tue Jul 14 19:57:11 UTC 2015 New revision: 285557 URL: https://svnweb.freebsd.org/changeset/base/285557 Log: Make bsdinstall's zfsboot script align partitions to 4k/1m when the user requests it PR: 195174 Reviewed by: darius Approved by: brueffer MFC after: 3 days Relnotes: yes Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D3062 Changes: head/usr.sbin/bsdinstall/scripts/zfsboot A commit references this bug: Author: allanjude Date: Mon Jul 20 16:17:44 UTC 2015 New revision: 285721 URL: https://svnweb.freebsd.org/changeset/base/285721 Log: MFC: r285482 A variable was misspelled resulting in chmod executing on the installer instead of on the target chroot PR: 191402 MFC: r285553 make /var/audit its own dataset so it is not part of the OS boot environment PR: 199864 MFC: r285554 Set a mountpoint on the root of the pool so user-created datasets have a mountpoint to inherit MFC: r285557 Make bsdinstall's zfsboot script align partitions to 4k/1m when the user requests it PR: 195174 Approved by: re (gjb), brueffer Relnotes: yes Sponsored by: ScaleEngine Inc. Changes: _U stable/10/ stable/10/usr.sbin/bsdinstall/scripts/zfsboot Been experimenting with 10.2-RC1 and this seems to work as expected. :) Hello. FreeBSD 10.3 - UFS auto partitioning not aligning partitions, manual partitioning not aligning partitions. Tried on GPT, but think MBR have same issue. (In reply to Dron from comment #15) Indeed, a 10.3 install specifying UFS on GPT does *not* align partitions on 4k. Here is a result: => 34 125829053 ada0 GPT (60G) 34 1024 1 freebsd-boot (512K) 1058 119536640 2 freebsd-ufs (57G) 119537698 6291388 3 freebsd-swap (3.0G) 125829086 1 - free - (512B) On the other hand, the FreeBSD-11.0 got it (mostly) right: Installing FreeBSD-11.0-BETA1-amd64-disc1.iso on VirtualBox, specifying UFS and GPT: Auto (UFS) - Guided Disk Setup <Entire Disk> GPT - GUID Partition Table *does* get partitions 4k aligned: $ gpart show => 40 125829040 ada0 GPT (60G) 40 1024 1 freebsd-boot (512K) 1064 119536640 2 freebsd-ufs (57G) 119537704 6291375 3 freebsd-swap (3.0G) 125829079 1 - free - (512B) It would still be nicer to have freebsd-ufs and freebsd-swap partitions aligned on 1 MB, the same as with a ZFS install - there is no reason for a UFS/GPT to align partitions differently from ZFS/GPT. |