public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Use of directories to hold root?
@ 2007-08-10 21:24 Mark Cannon
  2007-08-10 21:33 ` Jan Engelhardt
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Cannon @ 2007-08-10 21:24 UTC (permalink / raw)
  To: linux-kernel

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Use of directories to hold root?
  2007-08-10 21:24 Use of directories to hold root? Mark Cannon
@ 2007-08-10 21:33 ` Jan Engelhardt
  2007-08-11  0:08   ` H. Peter Anvin
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Engelhardt @ 2007-08-10 21:33 UTC (permalink / raw)
  To: Mark Cannon; +Cc: linux-kernel


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
-- 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Use of directories to hold root?
  2007-08-10 21:33 ` Jan Engelhardt
@ 2007-08-11  0:08   ` H. Peter Anvin
  2007-08-11 15:55     ` Jan Engelhardt
  0 siblings, 1 reply; 10+ messages in thread
From: H. Peter Anvin @ 2007-08-11  0:08 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Mark Cannon, linux-kernel

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Use of directories to hold root?
  2007-08-11  0:08   ` H. Peter Anvin
@ 2007-08-11 15:55     ` Jan Engelhardt
  2007-08-11 16:07       ` Al Viro
  2007-08-12 19:39       ` Mark Cannon
  0 siblings, 2 replies; 10+ messages in thread
From: Jan Engelhardt @ 2007-08-11 15:55 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Mark Cannon, linux-kernel


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
-- 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Use of directories to hold root?
  2007-08-11 15:55     ` Jan Engelhardt
@ 2007-08-11 16:07       ` Al Viro
  2007-08-12 19:39       ` Mark Cannon
  1 sibling, 0 replies; 10+ messages in thread
From: Al Viro @ 2007-08-11 16:07 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: H. Peter Anvin, Mark Cannon, linux-kernel

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(".");

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Use of directories to hold root?
  2007-08-11 15:55     ` Jan Engelhardt
  2007-08-11 16:07       ` Al Viro
@ 2007-08-12 19:39       ` Mark Cannon
  2007-08-12 19:49         ` Jan Engelhardt
  1 sibling, 1 reply; 10+ messages in thread
From: Mark Cannon @ 2007-08-12 19:39 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: H. Peter Anvin, linux-kernel

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Use of directories to hold root?
  2007-08-12 19:39       ` Mark Cannon
@ 2007-08-12 19:49         ` Jan Engelhardt
  2007-08-12 20:23           ` Al Viro
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Engelhardt @ 2007-08-12 19:49 UTC (permalink / raw)
  To: Mark Cannon; +Cc: H. Peter Anvin, linux-kernel


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
-- 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Use of directories to hold root?
  2007-08-12 19:49         ` Jan Engelhardt
@ 2007-08-12 20:23           ` Al Viro
  2007-08-12 20:55             ` Jan Engelhardt
  0 siblings, 1 reply; 10+ messages in thread
From: Al Viro @ 2007-08-12 20:23 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Mark Cannon, H. Peter Anvin, linux-kernel

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...

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Use of directories to hold root?
  2007-08-12 20:23           ` Al Viro
@ 2007-08-12 20:55             ` Jan Engelhardt
  2007-08-12 20:57               ` H. Peter Anvin
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Engelhardt @ 2007-08-12 20:55 UTC (permalink / raw)
  To: Al Viro; +Cc: Mark Cannon, H. Peter Anvin, linux-kernel


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
-- 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Use of directories to hold root?
  2007-08-12 20:55             ` Jan Engelhardt
@ 2007-08-12 20:57               ` H. Peter Anvin
  0 siblings, 0 replies; 10+ messages in thread
From: H. Peter Anvin @ 2007-08-12 20:57 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Al Viro, Mark Cannon, linux-kernel

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-08-12 21:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-10 21:24 Use of directories to hold root? Mark Cannon
2007-08-10 21:33 ` Jan Engelhardt
2007-08-11  0:08   ` H. Peter Anvin
2007-08-11 15:55     ` Jan Engelhardt
2007-08-11 16:07       ` Al Viro
2007-08-12 19:39       ` Mark Cannon
2007-08-12 19:49         ` Jan Engelhardt
2007-08-12 20:23           ` Al Viro
2007-08-12 20:55             ` Jan Engelhardt
2007-08-12 20:57               ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox