Use of directories to hold root?
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
Quoted 4 lines · Mark Cannon
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
Quoted 6 lines · Jan Engelhardt
Quoted 3 lines · Mark Cannon
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
Quoted 10 lines · H. Peter Anvin
Quoted 6 lines · Jan Engelhardt
Quoted 3 lines · Mark Cannon
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
Quoted 8 lines · Jan Engelhardt
Quoted 6 lines · H. Peter Anvin
Quoted 5 lines · Jan Engelhardt
Quoted 3 lines · Mark Cannon
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?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
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(".");
Quoted 13 lines · Jan Engelhardt
Quoted 10 lines · H. Peter Anvin
Quoted 6 lines · Jan Engelhardt
Quoted 3 lines · Mark Cannon
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.
Quoted 8 lines
mount --move /foo /
=> errorWhat 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
Quoted 7 lines · Mark Cannon
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
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_MOVEconcept. 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
Quoted 7 lines · Jan Engelhardt
Quoted 5 lines · Mark Cannon
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
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.
Quoted 6 lines
Quoted 2 lines
I am not sure I understand initramfs with
MS_MOVEconcept. I will look into it. Any pointers for documentation?
pivot_rootis atomic afaict, formount --move(which I think Al meant whichMS_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...
Quoted 7 lines · Al Viro
Quoted 4 lines
pivot_rootis atomic afaict, formount --move(which I think Al meant whichMS_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
Quoted 9 lines · Jan Engelhardt
Quoted 5 lines · Al Viro
Quoted 3 lines
pivot_rootis atomic afaict, formount --move(which I think Al meant whichMS_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