[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ubuntu-devel-discuss
Subject:    Using subdirectory as file system root
From:       kasperd () vghmv ! 23 ! jul ! 2011 ! kasperd ! net (Kasper Dupont)
Date:       2011-07-24 9:35:31
Message-ID: 20110724093531.GA7468 () colin ! search ! kasperd ! net
[Download RAW message or body]

On 23/07/11 00.12, Kasper Dupont wrote:
> I think for being able to dual boot between two different
> distributions (or two versions of the same distribution),
> it would be convenient if it wasn't necessary to create a
> separate root partition for each.
> 
> Instead I think it would be much more convenient if a
> subdirectory could be used as the root file system. Then
> different subdirectories can hold different distributions.
> 
> It only takes a small amount of code to support it. This
> patch should be all that is required for initramfs-tools
> to support it.
> 
> Anybody else find such a feature useful?
> 
> --- /usr/share/initramfs-tools/init	2010-04-26 17:16:54.000000000 +0200
> +++ ./init	2011-07-22 23:47:03.988718024 +0200
> @@ -2,6 +2,7 @@
>  
>  [ -d /dev ] || mkdir -m 0755 /dev
>  [ -d /root ] || mkdir -m 0700 /root
> +[ -d /rootfs ] || mkdir -m 0700 /rootfs
>  [ -d /sys ] || mkdir /sys
>  [ -d /proc ] || mkdir /proc
>  [ -d /tmp ] || mkdir /tmp
> @@ -33,6 +34,7 @@
>  # Export relevant variables
>  export ROOT=
>  export ROOTDELAY=
> +export ROOTDIR=
>  export ROOTFLAGS=
>  export ROOTFSTYPE=
>  export IPOPTS=
> @@ -115,6 +117,9 @@
>  			;;
>  		esac
>  		;;
> +	rootdir=*)
> +		ROOTDIR="${x#rootdir=}"
> +		;;
>  	resumedelay=*)
>  		RESUMEDELAY="${x#resumedelay=}"
>  		;;
> @@ -231,6 +236,13 @@
>  mountroot
>  log_end_msg
>  
> +if [ -n "$ROOTDIR" ] && [ -d "${rootmnt}/${ROOTDIR}" ]
> +then
> +	mount --move "${rootmnt}" "${rootmnt}fs"
> +	mount --bind "${rootmnt}fs/${ROOTDIR}" "${rootmnt}"
> +	umount "${rootmnt}fs"
> +fi
> +
>  maybe_break bottom
>  [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom"
>  run_scripts /scripts/init-bottom

I have set up a system that dual boots lucid and natty with
a single partition containing both roots. That part works
flawless. It turns out the most problematic part to get
working is actually the grub config.

I haven't been able to find any official documentation on
how to configure Ubuntu in a dual boot system, so I cannot
say for sure if the problems are related to my patch, though
it looks like the grub config problem would also be present
in a more conventional setup with a single boot partition
and a separate root partition for each install.

I am wondering if the proper way for me to proceed is to let
each install have its own boot directory under its root and
have the real boot partition just contain a small config
that can choose between the different installs. But I don't
know if it is possible in a grub configuration file to
specify that it should include another grub configuration
and interpret all paths in that relative to some specified
path.

Does this sound like a feasible approach, or is there some
other direction that it would be better for me to move in?

-- 
Kasper Dupont -- Rigtige m?nd skriver deres egne backupprogrammer
#define _(_)"d.%.4s%."_"2s" /* This is my email address */
char*_="@2kaspner"_()"%03"_("4s%.")"t\n";printf(_+11,_+6,_,11,_+2,_+7,_+6);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic