You pass the kernel the root option to specify the root partition.
Is there a way to identify a directory in that partition that holds the
root or something equivalent to this?
Something like:
kernel /vmlinuz26 root=/dev/sda3 root-directory=ker2621
If you independently examined /dev/sda3 you would find
/ker2611/
ker2621/
with the regular root structure under them (usr,bin,sbin,var,....)
We have 70+ remote machines we wish to bring up to date, and they
were not set up with any extra partitions. They are remote in that they
only connect briefly and have to be automatically updated.
I am open to other suggestions. The only other idea I have is to remotely/automatically
re-partition the disk to allow multiple roots in the future - scary stuff.
Please CC me when replying to this posting.
Thank you,
Mark
On Aug 10 2007 17:24, Mark Cannon wrote:
>
>You pass the kernel the root option to specify the root partition.
>Is there a way to identify a directory in that partition that holds the
>root or something equivalent to this?
No, but you can use pivot_root.
Jan
--
Jan Engelhardt wrote:
> On Aug 10 2007 17:24, Mark Cannon wrote:
>> You pass the kernel the root option to specify the root partition.
>> Is there a way to identify a directory in that partition that holds the
>> root or something equivalent to this?
>
> No, but you can use pivot_root.
Or better yet, use an initramfs with MS_MOVE; same as you would with the
"normal" use of initramfs.
-hpa
On Aug 10 2007 17:08, H. Peter Anvin wrote:
>Jan Engelhardt wrote:
>> On Aug 10 2007 17:24, Mark Cannon wrote:
>>> You pass the kernel the root option to specify the root partition.
>>> Is there a way to identify a directory in that partition that holds the
>>> root or something equivalent to this?
>>
>> No, but you can use pivot_root.
>
>Or better yet, use an initramfs with MS_MOVE; same as you would with the
>"normal" use of initramfs.
mount --move /foo /
=> error
What did I miss?
Jan
--
On Sat, Aug 11, 2007 at 05:55:37PM +0200, Jan Engelhardt wrote:
>
> On Aug 10 2007 17:08, H. Peter Anvin wrote:
> >Jan Engelhardt wrote:
> >> On Aug 10 2007 17:24, Mark Cannon wrote:
> >>> You pass the kernel the root option to specify the root partition.
> >>> Is there a way to identify a directory in that partition that holds the
> >>> root or something equivalent to this?
> >>
> >> No, but you can use pivot_root.
> >
> >Or better yet, use an initramfs with MS_MOVE; same as you would with the
> >"normal" use of initramfs.
>
> mount --move /foo /
> => error
mount("foo", "foo", NULL, MS_BIND, 0);
chdir("foo");
mount(".", "/", NULL, MS_MOVE, 0);
chroot(".");
On Saturday 11 August 2007, Jan Engelhardt wrote:
>
> On Aug 10 2007 17:08, H. Peter Anvin wrote:
> >Jan Engelhardt wrote:
> >> On Aug 10 2007 17:24, Mark Cannon wrote:
> >>> You pass the kernel the root option to specify the root partition.
> >>> Is there a way to identify a directory in that partition that holds the
> >>> root or something equivalent to this?
> >>
> >> No, but you can use pivot_root.
> >
> >Or better yet, use an initramfs with MS_MOVE; same as you would with the
> >"normal" use of initramfs.
>
> mount --move /foo /
> => error
>
> What did I miss?
>
>
>
> Jan
Thank you for the prompt replies. I have looked int pivot_root and
with my limited knowledge it looks like I could do this in the linuxrc
during start up. I believe the new kernel 2.6.21 is independent of the
root tree, so right after it mounts the old root /dev/sda3, it then can
pivot-root to /ker2621.
This can quickly be tested in the lab. I already use chroot for tests. Was
unaware of pivot_root.
I am not sure I understand initramfs with MS_MOVE concept. I will look into
it. Any pointers for documentation?
Again, thank you for the help.
Mark Cannon
On Aug 12 2007 15:39, Mark Cannon wrote:
>> >> No, but you can use pivot_root.
>> >
>> >Or better yet, use an initramfs with MS_MOVE; same as you would with the
>> >"normal" use of initramfs.
>
>I am not sure I understand initramfs with MS_MOVE concept. I will look into
>it. Any pointers for documentation?
pivot_root is atomic afaict, for `mount --move` (which I think Al meant
which MS_MOVE - or some C program using mount(2) of your own), you'd
need multiple calls to mount.
Jan
--
On Sun, Aug 12, 2007 at 09:49:02PM +0200, Jan Engelhardt wrote:
>
> On Aug 12 2007 15:39, Mark Cannon wrote:
> >> >> No, but you can use pivot_root.
> >> >
> >> >Or better yet, use an initramfs with MS_MOVE; same as you would with the
> >> >"normal" use of initramfs.
> >
> >I am not sure I understand initramfs with MS_MOVE concept. I will look into
> >it. Any pointers for documentation?
>
> pivot_root is atomic afaict, for `mount --move` (which I think Al meant
> which MS_MOVE - or some C program using mount(2) of your own), you'd
> need multiple calls to mount.
Move itself is done by a single syscall anyway...
On Aug 12 2007 21:23, Al Viro wrote:
>>
>> pivot_root is atomic afaict, for `mount --move` (which I think Al meant
>> which MS_MOVE - or some C program using mount(2) of your own), you'd
>> need multiple calls to mount.
>
>Move itself is done by a single syscall anyway...
>
Yes, but you need needed 2 mounts, 1 chdir and one chroot. Plus, you
have not freed the data in the rootfs. (Well, neither does
pivot_root, but run-init from klibc will.)
Jan
--
Jan Engelhardt wrote:
> On Aug 12 2007 21:23, Al Viro wrote:
>>> pivot_root is atomic afaict, for `mount --move` (which I think Al meant
>>> which MS_MOVE - or some C program using mount(2) of your own), you'd
>>> need multiple calls to mount.
>> Move itself is done by a single syscall anyway...
>>
> Yes, but you need needed 2 mounts, 1 chdir and one chroot. Plus, you
> have not freed the data in the rootfs. (Well, neither does
> pivot_root, but run-init from klibc will.)
Yes, which is why it is highly inappropriate for this particular case,
since they have multiple roots that they presumably don't want deleted!
-hpa