[H-GEN] /dev/log inside a chroot

Bruce Campbell bc at humbug.org.au
Wed Aug 23 02:44:24 EDT 2000


[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics.  Please observe the list's charter.          ]

On 23 Aug 2000, Jason Henry Parker wrote:

jasonp> Bruce Campbell <bc at humbug.org.au> writes:
jasonp> 
jasonp> > You can also do wonders with hard links if you have the disk space on / .
jasonp> 
jasonp> Under what conditions does using hard links consume inordinate amounts
jasonp> of disk space?

As well you might know via ln(1), hard links can only be created on the
same filesystem as the original file/directory.  The so-called 'symbolic'
links are used to provide links to other files/directories on other
filesystems.

A Hard Link is literally, a hard link to the original file.  Where does
this come in handy in a chrooted filesystem?

Assume that you have the directory of '/chroot' as the base of your
chrooted filesystem.  If you are logging users into this chroot, you might
want to give them access to a reasonable install of files.

Rather than having '/chroot' be a seperate filesystem and also, a seperate
copy of files in /bin, /lib etc, you can have /chroot be the same
filesystem as '/' , and then hardlink each directory/file in /chroot/bin
to /bin, and so forth for /lib etc.

	ie:

		/chroot/bin/ls ->(hard, not symbolic)-> /bin/ls
	or
		/chroot/bin/ -> /bin/	( one link )

This saves duplication of diskspace for system utilities.  The downside is
that to save space (say by repeating for /usr), you must do your base
install on the one filesystem, thus having a large '/' footprint.

Another alternative (if you are trying to avoid duplication) is to NFS
export, read only, your system directories to your localhost, and mount
them back in, ie:

	/bin ->(nfs exported to localhost)-> /chroot/bin

This is another headache.

If, by now, you're wondering why having multiple copies of files is such
an issue, at the time I was setting up 4 seperate chrooted environments on
a machine with limited diskspace, and working around limitations in
characteristics of linux pseudo-terminal device files (summary of long and
painful process, /chroot/dev/ptyX must be hardlink to /dev/ptyX).

All of this can vary with the varient of Unix in use.  TANSTAAFL.

-- 
  Bruce.                                                         | VP/BOFH
  Infinite Monkeys.  Infinite Keyboards.  I see no Shakespeare.  |  HUMBUG
  Usenet may or may not be an implementation of RFC2795.         |     PAN


--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.



More information about the General mailing list