-
Notifications
You must be signed in to change notification settings - Fork 161
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
Fix booting ZFS images. #921
Conversation
It sounds as if some folks were using the raw image support with |
a14abfb
to
0d791a6
Compare
That's the goal of the zrawdisk type, if you want some partition table I suggest you put that in a new zdisk type image. |
@davidchisnall this sounds very handy |
I'll try to refactor this to pull out the common bits and add a bootable zdisk type either this week or at the weekend. |
I've just pushed the refactoring. I've tried to minimise the copy-and-pasted code by pulling things out into include/fs.sh. This version almost preserves the existing behaviour of zrawdisk. I'd welcome feedback if the change is annoying to anyone: The existing zrawdisk code used the image name to specify the name of the ZFS root pool. I have changed this so that it is always zroot (as with the installer and all of the examples in the handbook). Using a non-zroot name was necessary before because the alternate name of the pool was not set and so if the host system had a pool called zroot then it would fail. I am now using the image name to generate the alternate name, so it works unless you are trying to generate two images with the same name at the same time (and since they'd end up in the same file - don't do that!). Does anyone want / depend on the old behaviour? |
@evadot, can you review? Apparently I don't have permissions to explicitly request reviewers on this repo. |
Yes I plan to do this this week, no firm ETA |
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.
Could you :
squash the commits (I don't like having one commit breaking zrawdisk and the one after unbreaking it and adding zdisk)
Move the stuff out from include/fs.sh, this is a file for poudriere and I'd like to have the poudriere image bits separated.
Otherwise looks good.
@evadot, I've done the refactoring but I can't figure out how to install the image_helpers.sh file. Everything I worked on that used GNU autotools moved to CMake a decade ago and so I've never had to touch a build system like this before. |
I have tried:
I am now giving up. |
src/share/poudriere/include/fs.sh
Outdated
zfs set mountpoint=none ${zroot}/ROOT/default | ||
zfs set readonly=on ${zroot}/var/empty | ||
zpool set bootfs=${zroot}/ROOT/default ${zroot} | ||
zpool set autoexpand=on ${zroot} |
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.
nice :-)
@evadot I am not joking about not being able to make the build system work. I have added the new file to Makefile.am and run
The offending line is:
I have no idea where that came from or why. At this point, it would take me less time to rewrite the build system in CMake than to figure out how GNU autothingies work. Please advise. |
See my commit when I added the split (b768a36) I have no clue about autotool TBH. |
FreeBSD now requires ZFS bootable vdevs to live in partitions, rather than be raw disks. This change adds a zdisk type that creates a GPT partition table and installs both MBR and UEFI boot loaders. The zrawdisk mode should generate a single ZFS partition as before. Common code between rawdisk, zrawdisk, and zdisk has been factored out. The zrawdisk and zdisk targets now always calls the zpool zroot, since that's what all of the docs expect and it's annoying to boot a VM image and find its ZFS root pool is called something else. The image name is used to generate a *temporary* name that means that this works even if the host already has a ZFS pool called zroot. Tested booting an image as a Hyper-V Gen1 (MBR) and Gen2 (UEFI) VM. Fixes freebsd#735
eda24e0
to
6692c69
Compare
I've put the helpers into |
All checks passing, I believe this should be ready to land. |
Well commit shouldn't say "Fix booting ZFS images." as this doesn't fix anything, that adds a new type. |
Welcome to GitHub, where you can edit commit messages when you press the squash and merge button.
This patch is needed for me to be able to build Azure-bootable FreeBSD disk images. I've been trying to get it merged for over a month now. Please either:
|
I won't do that.
Move the zdisk image stuff in image_zdisk.sh and no I won't do the change myself, you're a grown man.
|
FreeBSD now requires ZFS bootable vdevs to live in partitions, rather
than be raw disks. This change creates a GPT partition table and
installs both MBR and UEFI boot loaders.
This change also uses the image name as a temporary name for the zpool
so that zroot can be consistently called zroot, without introducing a
conflict with the host system's zroot. If there is a use case for
having a non-default name for zroot then this can be changed.
Tested booting an image as a Hyper-V Gen1 (MBR) and Gen2 (UEFI) VM.
zrawdisk is no longer a raw disk and so probably needs renaming.
Fixes #735