-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port of illumos #7446 - zpool create should support efi system partition #11029
Conversation
Authored by: Toomas Soome <[email protected]> Reviewed by: Andrew Stormont <[email protected]> Reviewed by: Yuri Pankov <[email protected]> Approved by: Dan McDonald <[email protected]> Ported-by: Brian Behlendorf <[email protected]> Ported-by: Nahum Shalman <[email protected]> OpenZFS-issue: https://illumos.org/issues/7446 OpenZFS-commit: openzfs/openzfs@7855d95 Reverts "Remove unused `zpool_is_bootable`" This reverts commit 663a070.
@nshalman Awesome, was looking forward to the (draft) PR of this! :) Some sidenotes :
illumnos != (or =/= ) OpenZFS, OpenZFS issues are not filled @ illumnos anymore...
OpenZFS issues and PR's are filed here. The OpenZFS/OpenZFS repo has been depricated/archieved about 10 months ago and replaced with this one. You can safely remove those two references and copy any relevant info to this place instead, to keep a clean PR log. 💯 On-topic/code: |
@Ornias1993
I've cleaned that up a bit. Let me know if you'd like further changes.
@tsoome gets all credit for the work and the documentation! |
((vtoc->efi_lbasize == 512 && | ||
boot_size < 33 * 1024 * 1024) || | ||
(vtoc->efi_lbasize == 4096 && | ||
boot_size < 256 * 1024 * 1024))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this size may not be enough to create fat32
Some notes from IRC:
|
zpool_label_name(vtoc->efi_parts[0].p_name, EFI_PART_NAME_LEN); | ||
/* first fix the partition start block */ | ||
if (start_block == MAXOFFSET_T) | ||
start_block = NEW_START_BLOCK; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference, there is a small issue - the block numbers around here are in units of 512B.
vtoc->efi_parts[8].p_tag = V_RESERVED; | ||
/* | ||
* EFI System partition is using slice 0. | ||
* ZFS is on slice 1 and slice 8 is reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we finally get rid of the old Sun manufacturing slice 8? it has nothing to do with ZFS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The disk expansion code in lib/libefi/rdwr_efi.c
which is needed when doing an expansion with zpool online -e <pool> <disk>
(which is a feature I care about) seems to currently also depend on the existence of that reserved partition.
Also, unfortunately in direct tension with this PR as written is the fact that the linux specific zfs_append_partition
in lib/libzutil/os/linux/zutil_device_path_os.c
currently seems to assume that the pool is on always partition 1.
So in principle, "sure." In practice, maybe that should be a separate PR? Also, I'm not sure how much backward compatibility we want to retain for expanding pools both with and without that extra partition. Maintaining the backward compatibility might be harder than keeping the partition around on new pools.
Please note, the expandsz issue turned out to be entirely illumos issue and result of mis-merge of another feature. See also https://code.illumos.org/c/illumos-gate/+/963 |
Please note: illumnos bugs/issues are not related to this project (anymore). Illumnos is not part of the list of OS’s this project develops for. Want to say that extra clearly now, due to all the illumnos references. |
This specific feature was developed on, and is being ported from illumos, so the comments and notes are relevant to this PR. Are you saying which OS, and which notes should or should not be mentioned? |
The constant illumnos references just get increasingly confusing.... Als there doesnt exist a “openzfs 7446”, see the new contribution guidelines: openzfs ports are dropped, because this project == openzfs ;) |
I'm trying to bisect the minimum fat32 size using: g() { truncate -s $1 /var/tmp/fat; losetup -b 4096 /dev/loop0 /var/tmp/fat; mkfs.vfat -F32 /dev/loop0; losetup -d /dev/loop0;rm /var/tmp/fat; } |
2.8GB? that is not right for minimum size, you probably need to set sectors per cluster 1 (-s 1). Should end up somewhere ~260MB. |
I'm redoing it now. I made a mistake there was another error reported by losetup. Thanks for '-s 1' I missed it. Here the new result. $ g 269062143 $ g 269062144 So, the minimum size seems 269062144. |
Title fixed too. |
Based in the disk format of my work linux laptop, I'm inclined to just bump the default EFI partition size all the way up to 512MB. Anyone who is using this feature by simply adding |
The code as written doesn't currently work properly because the linux specific |
I think I was in over my head. :( |
Motivation and Context
Original illumos issue from @tsoome: https://illumos.org/issues/7446
Since we support whole-disk configuration for boot pool, we also will need whole disk support with UEFI boot and for this, zpool create should create efi-system partition.
We have borrowed the idea from Oracle Solaris, and introduced a zpool create -B switch to provide a way to specify that a boot partition should be created.
The default partition size is 256MB (the minimum size for FAT32 with 4k blocks).
To support custom sizes, the set on creation "bootsize" property is created and so the custom size can be set as e.g.:
zpool create -B -o bootsize=34MB rpool sda
After the pool is created, the "bootsize" property is read only. When the -B switch is not used, the bootsize defaults to 0 and is shown in zpool get output with value '-'. Older zfs/zpool implementations are ignoring this property.
Abandoned previous attempt: #7664
Description
Since we support whole-disk configuration for boot pool, we also will need whole disk support with UEFI boot and for this, zpool create should create efi-system partition.
How Has This Been Tested?
Local compilation and testing on Debian Buster using a 4.19 kernel:
-B
Help Requested
There's one Linux specific file that presumably needs to be ported to FreeBSD. Pinging @tsoome (thanks for the original work!!!) and @allanjude for visibility.
Types of changes
Checklist:
Signed-off-by
.