Hi,

Thanks for your advice.

Since now, I'm looking for ec2 kind scenario where initramfs sits outside
VM and I don’t have access to change initramfs ; what will be good logic
to carry-on.. And also suggests ways for non-debian systems that don’t
support initramfs..



- regards
   Pallab


-----Original Message-----
From: Taisuke Yamada [mailto:[email protected]]
Sent: Monday, July 06, 2009 3:23 PM
To: [email protected]
Subject: Re: aufs to unify & mask root file system

Hi.

I've been doing the same thing to clone "host" environment
into "guest" for NFSroot/OpenVZ virtualization. This is a
BIG WIN of aufs as I can instantly create test environment
which is 100% same as running server.

To do this, you will need some tricks in initramfs.
Actual detail depends on what you want to accomplish, so
I'll try to explain it in following.

=== Case #1: Writable / on read-only media ===
If you just want to have "on-memory /" like many CD-based distributions,
following trick in initramfs will do:

  1. Mount "root" partion to /ro
  2. Mount tmpfs to /rw
  3. Mount /rw and /ro to / with aufs

I use "rootaufs" initramfs hook script (attached) to run Debian
on flash memory, but with all writes going to RAM.

=== Case #2: AUFS-able / for host-cloning ===
I believe this is what you want. You (probably) have a single-
partitioned Linux system, and since aufs inhibits "loop" structure,
you're denied to aufs-mount "/" onto some subfolder.

To workaround this, you will need to split root partion into
2 folders - the former for "/", and the latter for keeping
aufs-mountpoints. In initramfs, you can bind mount the latter
into the former and then aufs will not complain.

I'm not sure if this was clear enough, so let me restate
differences between standard configuration and this "aufs-on-
outerspace" configuration:

  [standard configuration]
  1. Has / on /dev/sda1
  2. In initramfs, mounts /dev/sda1 to /

  ["outerspace" configuration]
  1. Has /real_root and /work_area on /dev/sda1
  2. In initramfs...
     a) mounts /dev/sda1:/real_root on /
     b) mounts /dev/sda1:/work_area on /aufs (or anywhere you like)

I have attached my "outerspace" initramfs hook script as an example,
but please note my disk setup (pathname) is different from the above.
I have /dev/sda1:/disk/base as "/", and /dev/sda1:/disk/ as "/..." for
aufs mounting.

I think you can also do it by loopback-mounting some writable image
and then aufs-mount in that mounted area (I haven't tried it - actually,
I don't do this "outerspace" configuration anymore as now I have multi-
partitioned setup).

Hope this helps.

>> I require to use aufs to unify & mask "/" root file system, like :
>>   mount -t aufs -o br=/.rw:/.ro/=ro none /
>>
>> Pls advice how to make the fstab entry compatible as above or there're
>> alternatives ..
>
> Generally people executes chroot or switch_root.
> I'd suggest you to check the init (linuxrc) script in LiveCDs or
> diskless sample in aufs1.
>
> J. R. Okajima
>
--------------------------------------------------------------------------
----


Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.5/2220 - Release Date: 07/05/09
17:54:00

------------------------------------------------------------------------------

Reply via email to