-
Notifications
You must be signed in to change notification settings - Fork 158
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
overlay.d/05core: support booting ISO completely from RAM #2544
overlay.d/05core: support booting ISO completely from RAM #2544
Conversation
In coreos/fedora-coreos-config#2544 we added a new `coreos.liveiso.fromram` kernel argument to instruct the ISO image to boot completely from memory in order to facilitate installs back to the same disk the ISO was booted from in iso-as-disk mode (i.e. dd the ISO file to a hard drive or partition on a hard drive). Let's test here that we can boot completely from memory and that /run/media/iso is not mounted. Currently this doesn't actually do an install to the same disk that we booted from (actually the iso-as-disk tests don't actually do installs at all, but just verify they can boot), but rather just verifies the ISO isn't mounted after the live system boots up, which should be sufficient.
tests for this over in coreos/coreos-assembler#3555 |
In theory too what we could do is make the whole thing dynamic using something like devicemapper - basically we only need to move ourself to RAM when we go to do an install. So we could e.g. set up devicemapper raid in raid1 backed just by the ISO originally. Then when we want to run coreos-installer, we create the ramfs and add it to the raid, then wait for the raid to sync, then unplug the disk. Or maybe dm switch ? But...dunno, maybe a kernel argument is just simpler. |
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.
An interesting thing here is this becomes an API we need to maintain ~forever...but so far I don't think our initramfs glue has really had any public APIs? And hence there's no explicit place to document this in this repo, we'd need to add it to fedora-coreos-docs.
overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-liveiso-persist-osmet.service
Show resolved
Hide resolved
overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator
Outdated
Show resolved
Hide resolved
overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-liveiso-persist-osmet.service
Show resolved
Hide resolved
I imagine we'd document it wherever |
Yeah. In this kernel arg scenario When it comes to modifying |
This should be dead code now.
It has been presented to us a use case where the user wants to actually "install" directly to the same device that was used to boot the live ISO image (i.e. the ISO was written to a block device and then booted from). The way the ISO boots today it mounts the ISO at /run/media/iso and then mounts the CoreOS rootfs from a file under that mountpoint. In this scenario /run/media/iso will be busy and can't be unmounted because the root filesystem of the live running system depends on it. We can adjust the strategy slightly to get a system that runs completely from memory (similar to live PXE systems) by just copying the file out of /run/media/iso and into memory before doing the rootfs mount, which will allow /run/media/iso to be unmounted before the installation commences. This patchset adds a new coreos.liveiso.fromram option to allow requesting this new behavior. We could consider making this new behavior the default, but we'd need to consider the new RAM requirements. For example, before this change on a 2G FCOS system the usage after booting looks like: ``` [core@localhost ~]$ free -m total used free shared buff/cache available Mem: 1953 163 1286 125 503 1519 Swap: 0 0 0 ``` With this change (and the coreos.liveiso.fromram kernel arguemnt specified) the usage looks like: ``` [core@localhost ~]$ free -m total used free shared buff/cache available Mem: 1953 173 688 808 1091 824 Swap: 0 0 0 ``` The usage would scale with the size of the rootfs. i.e. RHCOS is larger so the memory requirements would be larger too.
c4adedc
to
1334b72
Compare
ok did a new push with the one requested deletion. I also rebased on top of latest |
In coreos/fedora-coreos-config#2544 we added a new `coreos.liveiso.fromram` kernel argument to instruct the ISO image to boot completely from memory in order to facilitate installs back to the same disk the ISO was booted from in iso-as-disk mode (i.e. dd the ISO file to a hard drive or partition on a hard drive). Let's test here that we can boot completely from memory and that /run/media/iso is not mounted. Currently this doesn't actually do an install to the same disk that we booted from (actually the iso-as-disk tests don't actually do installs at all, but just verify they can boot), but rather just verifies the ISO isn't mounted after the live system boots up, which should be sufficient.
In coreos/fedora-coreos-config#2544 we added a new `coreos.liveiso.fromram` kernel argument to instruct the ISO image to boot completely from memory in order to facilitate installs back to the same disk the ISO was booted from in iso-as-disk mode (i.e. dd the ISO file to a hard drive or partition on a hard drive). Let's test here that we can boot completely from memory and that /run/media/iso is not mounted. Currently this doesn't actually do an install to the same disk that we booted from (actually the iso-as-disk tests don't actually do installs at all, but just verify they can boot), but rather just verifies the ISO isn't mounted after the live system boots up, which should be sufficient.
In coreos/fedora-coreos-config#2544 we added a new `coreos.liveiso.fromram` kernel argument to instruct the ISO image to boot completely from memory in order to facilitate installs back to the same disk the ISO was booted from in iso-as-disk mode (i.e. dd the ISO file to a hard drive or partition on a hard drive). Let's test here that we can boot completely from memory and that /run/media/iso is not mounted. Currently this doesn't actually do an install to the same disk that we booted from (actually the iso-as-disk tests don't actually do installs at all, but just verify they can boot), but rather just verifies the ISO isn't mounted after the live system boots up, which should be sufficient.
In coreos/fedora-coreos-config#2544 we added a new `coreos.liveiso.fromram` kernel argument to instruct the ISO image to boot completely from memory in order to facilitate installs back to the same disk the ISO was booted from in iso-as-disk mode (i.e. dd the ISO file to a hard drive or partition on a hard drive). Let's test here that we can boot completely from memory and that /run/media/iso is not mounted. Currently this doesn't actually do an install to the same disk that we booted from (actually the iso-as-disk tests don't actually do installs at all, but just verify they can boot), but rather just verifies the ISO isn't mounted after the live system boots up, which should be sufficient.
In coreos/fedora-coreos-config#2544 we added a new `coreos.liveiso.fromram` kernel argument to instruct the ISO image to boot completely from memory in order to facilitate installs back to the same disk the ISO was booted from in iso-as-disk mode (i.e. dd the ISO file to a hard drive or partition on a hard drive). Let's test here that we can boot completely from memory and that /run/media/iso is not mounted. Currently this doesn't actually do an install to the same disk that we booted from (actually the iso-as-disk tests don't actually do installs at all, but just verify they can boot), but rather just verifies the ISO isn't mounted after the live system boots up, which should be sufficient. (cherry picked from commit 0955101)
In coreos/fedora-coreos-config#2544 we added a new `coreos.liveiso.fromram` kernel argument to instruct the ISO image to boot completely from memory in order to facilitate installs back to the same disk the ISO was booted from in iso-as-disk mode (i.e. dd the ISO file to a hard drive or partition on a hard drive). Let's test here that we can boot completely from memory and that /run/media/iso is not mounted. Currently this doesn't actually do an install to the same disk that we booted from (actually the iso-as-disk tests don't actually do installs at all, but just verify they can boot), but rather just verifies the ISO isn't mounted after the live system boots up, which should be sufficient. (cherry picked from commit 0955101)
It has been presented to us a use case where the user wants to actually "install" directly to the same device that was used to boot the live ISO image (i.e. the ISO was written to a block device and then booted from). The way the ISO boots today it mounts the ISO at /run/media/iso and then mounts the CoreOS rootfs from a file under that mountpoint. In this scenario /run/media/iso will be busy and can't be unmounted because the root filesystem of the live running system depends on it.
We can adjust the strategy slightly to get a system that runs completely from memory (similar to live PXE systems) by just copying the file out of /run/media/iso and into memory before doing the rootfs mount, which will allow /run/media/iso to be unmounted before the installation commences.
This patchset adds a new coreos.liveiso.fromram option to allow requesting this new behavior. We could consider making this new behavior the default, but we'd need to consider the new RAM requirements. For example, before this change on a 2G FCOS system the usage after booting looks like:
With this change (and the coreos.liveiso.fromram kernel arguemnt
specified) the usage looks like:
The usage would scale with the size of the rootfs. i.e. RHCOS is larger so the memory requirements would be larger too.