public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maciek Nowacki <maciek@Voyager.powersurfr.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Busy on BLKFLSBUF w/initrd
Date: Thu, 24 May 2001 12:39:43 -0600	[thread overview]
Message-ID: <20010524123943.A797@wintermute.starfire> (raw)
In-Reply-To: <20010523154843.A32583@Voyager.powersurfr.com>
In-Reply-To: <20010523154843.A32583@Voyager.powersurfr.com>; from maciek on Wed, May 23, 2001 at 03:48:43PM -0600

Problem seems to be solved. Here is what I did, for anyone who is interested
in using a loopback file on a local disk as root:

- create a romfs initrd with /linuxrc -> /bin/sh and an empty /initrd dir

- boot, with root=/dev/rd/1 init=/bin/sh

- when /linuxrc comes up, cat /dev/rd/0 > /dev/rd/1

- CTRL-D, exit, etc. to invoke change_root -> /dev/rd/1

- umount /initrd/dev and /initrd

- load modules needed for boot.. ext2, ide, loopback, crypto, and sticky
order-dependent things (in my case, uhci MUST precede eepro100)

- mount -n -t tmpfs none /tmp

- copy needed things to /tmp like /bin, /sbin, /lib (not modules, unless
memory isn't a problem)

- mount -n -t devfs none /tmp/dev

- cd /tmp ; pivot_root . old_root ; chroot bin/sh ...

- now we are chrooted into bin/sh on a tmpfs root

- umount old_root/dev ; umount old_root

- mount real filesystem - mount host on /mnt, loopback on /real_root

- finally chroot into real_root/sbin/init

- once system is running, clear out unneeded files in tmpfs, unmount the
  devfs - memory usage goes to almost nothing (tmpfs is still needed since
  the host for the loopback lives there)

- blockdev --flushbufs /dev/rd/*

(note, I have glossed over some details. /proc is needed in several steps,
and must be unmounted and remounted and so on..)

After running for a while and filling up memory, buffers has gone down far
below the size of the ramdisk, and trying to mount /dev/rd/0 and /dev/rd/1
shows that they are no longer valid filesystems.

This method depends on the change_root() mechanism which I had assumed is
becoming obsolete. It works, and there is no need to mess with
/proc/sys/kernel/real_root_dev if the root is specified on the command line.
Trying to use only pivot_root did not work as /dev/rd/0 could never be
flushed (see previous messages in this thread).

Thanks very much to everyone who helped!

Maciek

  parent reply	other threads:[~2001-05-24 18:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-23 21:48 Busy on BLKFLSBUF w/initrd Maciek Nowacki
2001-05-23 22:05 ` Alexander Viro
2001-05-23 22:11   ` Maciek Nowacki
2001-05-23 22:21     ` Alexander Viro
2001-05-23 23:23       ` Maciek Nowacki
2001-05-23 23:28         ` Alexander Viro
2001-05-23 23:45           ` Maciek Nowacki
2001-05-24  5:32   ` Mike Galbraith
2001-05-24 10:42     ` Alexander Viro
2001-05-24 10:56       ` Mike Galbraith
2001-05-24 11:24         ` Alexander Viro
2001-05-24 11:57           ` Herbert Xu
2001-05-24 13:27           ` Mike Galbraith
2001-05-24 13:33             ` Alexander Viro
2001-05-24 18:39 ` Maciek Nowacki [this message]
2001-05-25  5:20   ` Scott Murray
2001-05-25 15:42     ` Maciek Nowacki

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=20010524123943.A797@wintermute.starfire \
    --to=maciek@voyager.powersurfr.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox