Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Linux Containers - /proc mounting and other queries Post 303026769 by bakunin on Monday 3rd of December 2018 07:15:47 AM
Old 12-03-2018
Quote:
Originally Posted by sreyan32
Hi guys, I am confused about how containers work in Linux, especially how chrooting works and about how /proc filesystems are mounted.
You already got some excellent answers to your questions at hand but you might profit from a little "theory" behind all that, so here it goes:

Whenever we talk about virtualisation we need to keep in mind that there are to fundamentally different ways of doing so: "full virtualisation" and "para-virtualisation".

Full-virtualisation is what i.e. VMWare or the DOSbox emulator do: a program is started which emulates a certain hardware platform. On this emulated hardware an OS is installed and "runs" more or less independently from the host hardware. The advantage this has is that you can mix arbitrary platforms because it only depends on the availability of the emulator programs. You can install a PC-emulator onto Linux and run a WIndows guest in it, start it a second time and install another Linux to it, then start a third instance and install DOS onto that. Fully virtualised systems are not "aware" that they are virtualised. For the virtualised system it is like running on non-virtualised hardware.

Para-virtualisation on the other hand, does not work like this: hardware is only emulated up to a certain point. For instance, take the file system driver: if you work on a real disk you need to do all sorts of checks inside this driver because disk blocks could be failing, filesystems can get corrupted, etc.. The driver makes up for that to some extent by these checks. Now, a fully virtualised system has usually a fully virtualised disk which is in fact a file in the host systems filesystem. The driver of the virtualised machine wouldn't have to do all these checks because "under" it the disk driver of the host system (which really does the writing) will do it anyway. A para-virtualised disk driver is "aware" that it works on virtual hardware so it skips all these checks (and a lot of other unnecessary work) which makes the load the emulation places on the host system considerably lighter. The same goes for network drivers, etc.. The final development in this is to have not even a separate kernel for the guest OS but set aside some "space" in the host kernel where all the processes of the guest system go. At this point we usually do not call the guest systems "guest systems" any longer but call these "containers". The big advantage of paravirtualised systems is: the load produced by emulating the hardware itself is much lighter than in fully virtualised systems, so you get to run more guest systems from a given amount of host resources. On the downside, having only one kernel for all guests means that you can't have different OSes running but are limited to what the host system runs. Examples for para-virtualisation software are OpenVZ/Virtuozzo but also Docker.

What is chroot and how does it enter the picture: UNIX, since its earliest stages, has the chroot command, which creates a system environment limited to some separated part of the filesystem. Historically this was done to be able to safely operate FTP servers: in a certain directory a replica of the (important parts of the) main filesystem (like /usr/lib, /bin, etc.) was created and the absolute minimum of libs, commands, etc. were placed there. Then the FTP server process was started in a way so that this directory was the "root" of tis environment and it could not access any other file outside of this. This was done with the chroot command. This way users could access the FTP server and transfer files to ad from it - they might even mess up the FTP server itself, but this "chrooted" part only, not the "underlying" system. Para-virtualised guest systems - in specific containers - more or less resemble this and para-virtualisation is therefore sometimes regarded as "richly dressed up chroot environment".

I hope that connects a few loose ends.

bakunin

Last edited by bakunin; 12-03-2018 at 10:10 AM.. Reason: typo
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

mounting /proc or /usr

i am not quite sure what the purpose of mounting a filesystem that is already mounted.. i know you may want to mount /usr read only but do not know the true purpose behind this.. and why would /proc be mounted on /proc itself.. this is all new to me.. I have been reading up on it from various... (5 Replies)
Discussion started by: moxxx68
5 Replies

2. UNIX for Dummies Questions & Answers

CD mounting problems with linux

Hi guys I'm a newbie with linux i recently installed mandrake linux 10.0 double boot(win 98se) on a pIII 300mhz 128mb ram PC I have a standard cd rom and for some reason, linux refuses to mount the CD drive it worked perfectly for the first cople of monthes and than suddenly it didn't it... (0 Replies)
Discussion started by: bentzi
0 Replies

3. OS X (Apple)

mounting linux

firstly... sorry xDDD. now, how could i mount a linux partition on my mac os x ( i assume ill use terminal). i begins... i have my ubuntu linux partition on disk0s4. i tried: sudo mount /dev/disk0s4 /Volumes/Ubuntu and the system told me ;), "mount: exec /usr/sbin/mount_ext for... (1 Reply)
Discussion started by: Jariya
1 Replies

4. Red Hat

mounting ISO in linux

Hi Guys, I'm having a bit of trouble and im not sure what is the deal, I'm trying to mount an ISO on my RHEL box and it is not letting me... mount -o loop -t iso9660 /home/bgalante/rhel-5-server-i386-disc3.iso /mnt mount: Not a directory any idea what i am doing wrong? (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

5. Linux

Kernal panic error& setuproot:error mounting /proc&/sys

Hi all, I am new to redhat/fedora linux. In fedora linux 6,we created one file system(hda3 - /fs). in this mount poing we were installed mounta vista os. while booting we are getting below error messages. 1) Booting 'mountaVisat(2.6.18_pro 500_pc_target-x86_586 smp)' root(hd0,1)... (2 Replies)
Discussion started by: arjunreddy3
2 Replies

6. UNIX for Dummies Questions & Answers

_/proc/stat vs /proc/uptime

Hi, I am trying to calculate the CPU Usage by getting the difference between the idle time reported by /proc/stat at 2 different intervals. Now the 4th entry in the first line of /proc/stat will give me the 'idle time'. But I also came across /proc/uptime that gives me 2 entries : 1st one as the... (0 Replies)
Discussion started by: coderd
0 Replies

7. Linux

Tripwire Nightware on Linux (proc filesystem)

Hello, I am having a nightmare with Tripwire on Linux..... I cannot get it to ignore the /proc filesystem, which I want to completely ignore for now Has anyone here successfully configured Tripwire on Linux and completed ignored the /proc filesystem ? If so, please reply and tell me how... (0 Replies)
Discussion started by: Neo
0 Replies

8. Programming

Linux 11.2 to 10.2 Proc Compile error

I am trying to compile a proc++ program on linux using an 11.2 client and pointing to a 10.2 database running on Solaris. The compiler is able to connect to the database but the semantic checks fail as if it cannot see any objects in the database. I tried a test, only selecting 'X' into a... (0 Replies)
Discussion started by: rdudash
0 Replies

9. IP Networking

IP Address Linux Containers

Hello All, Please, i have a problem i try to find a solution since days i'm a beginner with linux (networking) In our cluster (10 nodes), we deploy the same image file on each node. So each node has a different ip address. In each image, there are several LXC containers. When I deploy the... (0 Replies)
Discussion started by: chercheur111
0 Replies

10. Red Hat

Looking for equivalent of Solaris containers/zones in RHEL7 Linux

Hi, I come from a legacy Solaris background with lots of experience with Solaris Containers/zones that we use for network and process isolation from each other. Currently we have a RHEL7 Linux VM running on VMWare, but we would like to segment that VM with some form of containers and achieve... (1 Reply)
Discussion started by: ckmehta
1 Replies
All times are GMT -4. The time now is 10:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy