From: Robert White <rwhite@pobox.com>
To: Marc Haber <mh+linux-btrfs@zugschlus.de>,
Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Subject: A good "Boot Maintenance" scheme (WAS: New file system with same issue)
Date: Wed, 16 Mar 2016 18:17:02 -0700 [thread overview]
Message-ID: <56EA058E.7060108@pobox.com> (raw)
In-Reply-To: <20160314201306.GH2334@torres.zugschlus.de>
On 03/14/2016 01:13 PM, Marc Haber wrote:
> This was not asked, and I didn't try. Since this is an encrypted root
> filesystem, is it a workable way to add clear_cache to /etc/fstab,
> rebuild initramfs and reboot? Or do you recommend using a rescue system?
You should be able to boot to single user mode and man-handle the
filesystem from there.
but if that's a problem...
I have a small (woefully incomplete) pre-alpha project on Sourceforge
called "underdog".
I currently use it to build the initramfs to boot all my systems.
So even if yo don't use it for production you can use it to make the
initramfs you'll need to have full BTRFS maintenance before any of your
filesystems are mounted.
You want this tool if you want to do pre-boot surgery without hassles.
(or you want a nice way to convert from extN to btrfs and back without
having a bunch of co-variant CDs.)
There's a README.txt, it's long... But basically:
(1) use git to download project
(2) go to your kernel build directory
(3) run /path/utility/make_initramfs_description.bash > .initramfs
where "path" is the path to the download location
(4) set CONFIG_INITRAMFS_SOURCE=".initramfs" in your kernel config
(5) build new kernel.
This creates a kernel which:
(A) Booted with a normal initramfs will run as if you didn't do the above.
(B1) Booted _without_ another initramfs will _probably_ boot normally as
long as all your disk related drivers are not kernel modules. (It
handles most layouts I've tried but some hosts have "the UID problem"
described below
(B2) Booted _without_ another initramfs but _with_ "bash" on the kernel
command line results in several opportunities to execute arbitrary
commands during the boot sequence, and provides the commands you need.
You are after mode B2.
So during a normal boot without another initramfs the system will
recursively examine all the disk block devices, identifying and
attaching cryptsetup, mdadm, and lvm2, and btrfs devices as it finds them.
Some of the prompting will get lost in the kernel boot messages because,
you know, multi-threading and all that.
Prompts:
"pre-loop#"; you've used "bash" option and it's about to start the disk
search.
A password prompt for a device; it's found a cryptsetup device it wants
to open. It'll give you three tries before moving on.
"post-loop#"; After the recursive search. _hopefully_ your root device
is mounted as "/root". The FS is (hopefully) mounted but the system is
completely independent of the mount.
So either use "pre-loop#" to do all your maintenance by hand, or go
through to "post-loop#" and unmount /root and then do as you must.
These prompts are from the uber-priviliged PID1 and you can exec into
other things (like an alternate init) as well as just running programs.
(control-d from "pre-loop#" or "post-loop#" will continue the script.
If you drop out to a bash shell prompt in B1 or B2 at the end then the
script could not deduce your layout. You can then do fixups and
whatever, and then mount anything as /root and then do the "exec busybox
switch_root /root /sbin/init" (or /init or whatever) to continue the
boot. That emergency bash prompt is still PID #1 and all the initramfs
conditions for init are still in force.
Anyway, having used "bash" you can use the pre- or post- loop prompts to
do any maintenance you wish. Up-arrow/history is _not_ available. But
you have btrfs, btrfsck, fsck, mount, blkid, mdadm, and lvm available to
you. (you can also issue "busybox --instal" to get all of the commands
like cp and vi and such).
Other simple emergency commands can be added to the foundational list by
creating/editing a utility/something.mod file or the script itself.
The magic of the script is that it will scour the system for dependent
interpreters and libraries for whatever commands you add to the
initramfs so you don't have to have "staticly linked" or otherwise
special utilities built.
Notes:
I've been using the kernel-inbuilt initramfs this creates in all my
development systems for years, it's quite stable... except where it's
not. 8-)
DO NOT USE "utility/make_initramfs.bash", it's depricated. If you want
to make a not-inbuilt initramfs image then follow the README.txt
instructions from item 3b (which is also easier).
Full Disclosure: It's a little wonky about using UIDs to find
filesystems right now because BASH likes to try to do math near the
minuses in the UIDs when looking up arrays. /sigh
next prev parent reply other threads:[~2016-03-17 1:25 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-27 21:14 Again, no space left on device while rebalancing and recipe doesnt work Marc Haber
2016-02-27 23:15 ` Martin Steigerwald
2016-02-28 0:08 ` Marc Haber
2016-02-28 0:22 ` Hugo Mills
2016-02-28 8:40 ` Marc Haber
2016-02-29 1:56 ` Qu Wenruo
2016-02-29 15:33 ` Marc Haber
2016-03-01 0:45 ` Qu Wenruo
[not found] ` <20160301065448.GJ2334@torres.zugschlus.de>
2016-03-01 7:24 ` Qu Wenruo
2016-03-01 8:13 ` Qu Wenruo
[not found] ` <20160301161659.GR2334@torres.zugschlus.de>
2016-03-03 2:02 ` Qu Wenruo
2016-03-01 20:51 ` Duncan
2016-03-05 14:28 ` Marc Haber
2016-03-03 0:28 ` Dāvis Mosāns
2016-03-03 3:42 ` Qu Wenruo
2016-03-03 4:57 ` Duncan
2016-03-03 15:39 ` Dāvis Mosāns
2016-03-04 12:31 ` Duncan
2016-03-04 12:35 ` Hugo Mills
2016-03-27 12:10 ` Martin Steigerwald
2016-03-27 23:12 ` Duncan
2016-03-05 14:39 ` Marc Haber
2016-03-05 19:34 ` Chris Murphy
2016-03-05 20:09 ` Marc Haber
2016-03-06 6:43 ` Duncan
2016-03-06 20:27 ` Chris Murphy
2016-03-06 20:37 ` Chris Murphy
2016-03-07 8:47 ` Marc Haber
2016-03-07 8:42 ` Marc Haber
2016-03-07 18:39 ` Chris Murphy
2016-03-07 18:56 ` Austin S. Hemmelgarn
2016-03-07 19:07 ` Chris Murphy
2016-03-07 19:33 ` Marc Haber
2016-03-12 21:36 ` Marc Haber
2016-03-07 19:44 ` Chris Murphy
2016-03-07 20:43 ` Duncan
2016-03-07 22:44 ` Chris Murphy
2016-03-12 21:30 ` Marc Haber
2016-03-07 8:30 ` Marc Haber
2016-03-07 20:07 ` Duncan
2016-03-07 8:56 ` Marc Haber
2016-03-12 19:57 ` Marc Haber
2016-03-13 19:43 ` Chris Murphy
2016-03-13 20:50 ` Marc Haber
2016-03-13 21:31 ` Chris Murphy
2016-03-12 21:14 ` Marc Haber
2016-03-13 11:58 ` New file system with same issue (was: Again, no space left on device while rebalancing and recipe doesnt work) Marc Haber
2016-03-13 13:17 ` Andrew Vaughan
2016-03-13 16:56 ` Marc Haber
2016-03-13 17:12 ` Duncan
2016-03-13 21:05 ` Marc Haber
2016-03-14 1:05 ` Duncan
2016-03-14 11:49 ` Marc Haber
2016-03-13 19:14 ` Henk Slager
2016-03-13 19:42 ` Henk Slager
2016-03-13 20:56 ` Marc Haber
2016-03-14 0:00 ` Henk Slager
2016-03-15 7:20 ` Marc Haber
2016-03-14 12:07 ` Marc Haber
2016-03-14 12:48 ` New file system with same issue Holger Hoffstätte
2016-03-14 20:13 ` Marc Haber
2016-03-15 10:52 ` Holger Hoffstätte
2016-03-15 13:46 ` Marc Haber
2016-03-15 13:54 ` Austin S. Hemmelgarn
2016-03-15 14:09 ` Marc Haber
2016-03-17 1:17 ` Robert White [this message]
2016-03-14 13:46 ` New file system with same issue (was: Again, no space left on device while rebalancing and recipe doesnt work) Henk Slager
2016-03-14 20:05 ` Marc Haber
2016-03-14 20:39 ` Henk Slager
2016-03-14 21:59 ` Chris Murphy
2016-03-14 23:22 ` Henk Slager
2016-03-15 7:16 ` Marc Haber
2016-03-15 12:15 ` Henk Slager
2016-03-15 13:24 ` Marc Haber
2016-03-15 7:07 ` Marc Haber
2016-03-27 12:15 ` Martin Steigerwald
2016-03-15 13:29 ` Marc Haber
2016-03-15 13:42 ` Marc Haber
2016-03-15 16:54 ` Henk Slager
2016-03-27 8:41 ` Current state of old filesystem " Marc Haber
2016-04-01 13:59 ` Again, no space left on device while rebalancing and recipe doesnt work Marc Haber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56EA058E.7060108@pobox.com \
--to=rwhite@pobox.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=mh+linux-btrfs@zugschlus.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.