All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] A quick humfs HOWTO
@ 2004-04-08  2:07 Jeff Dike
  2004-04-08  6:25 ` Nuno Silva
                   ` (4 more replies)
  0 siblings, 5 replies; 23+ messages in thread
From: Jeff Dike @ 2004-04-08  2:07 UTC (permalink / raw)
  To: user-mode-linux-user, user-mode-linux-devel

As the readers of uml-devel are aware by now, there is a new virtual UML 
filesystem called humfs.  This is a hostfs-like filesystem which does ownerships
right, by separating them from the actual file, ala umsdos.

The reasons for humfs are described in my latest diary entry at 
	http://user-mode-linux.sourceforge.net/diary.html

This post describes how it works, and how to set it up.  This will be expanded
upon and added to the UML site.

Unlike a hostfs-mounted directory, a humfs filesystem has a definite root, and
must be prepared ahead of time.  There is a tool in the latest uml_utilities
called humfsify which does this for you, so don't use the following description
to set one up by hand.

The root contains two directories :
	data - which contains the files
	metadata - which shadows "data" and whose files contain ownership 
		information
and one file
	superblock - which contains information about the filesystem as a 
		whole

For plain files, the corresponding metadata file has the format
	"<uid> <gid>\n"
i.e. "0 0\n" for a uid root, gid root file.

For directories, the format is the same, except that ownership is in the 
"metadata" file in its metadata directory.  In the event that there is a real
"metadata" file, its ownerships will be on the second line of that file.

For example, the directory /foo/bar/ has both data/foo/bar/ and metadata/foo/bar
directories.  Its ownerships are in the file metadata/foo/bar/metadata.  If
there is a /foo/bar/metadata, then its ownerships are also in that file, which
would then look like
	"<directory uid> <directory gid>\n<file uid> <file gid>\n"

This second line thing isn't implemented yet, so don't go creating files called
metadata just now.

For character and block devices the data file exists, but is empty, and the
metadata file has the format
	"<uid> <gid> <type> <major> <minor>\n"

uid and gid are as above.  major and minor are self-explanatory.  type is
either of the characters 'b' and 'c', depending on whether it's a block or
character device.

Unix sockets are similar, except they have no major and minor numbers, and
have a type of 's' :
	"<uid> <gid> s\n"

The superblock file has the format
	"version <number>\nused <number>\ntotal <number>\n"

The version is currently 1.  used is set to the disk space consumed by 
everything in the data directory.  total is set arbitrarily when you set
up the filesystem.  It is the size of the filesystem as seen within UML.

humfsify is in the uml_utilities tarball in ./humfsify/humfsify.  Before running
it, you need to create an empty directory, then copy the filesystem you want
to mount to the "data" subdirectory of the new directory.  cd to the new
directory, and run humfsify as root:
	humfsify <user> <group> <size>

user and group are the uid and gid that UML will be running as, respectively.
size is the size of the filesystem as seen inside UML, specified in bytes.
The suffixes "K", "M", and "G" are accepted, and have the obvious meanings.

humfsify will walk the "data" hierarchy and create the "metadata" hierarchy
and the superblock file.

Once this is done, it is ready for use a UML which is version 2.4.24-2 or later.
To boot UML on this, enable CONFIG_HUMFS, and replace the ubd0=... argument
with 
	root=/dev/root rootflags=<path to humfs root> rootfstype=humfs

UML will boot as it usually does, and you will see a humfs rootfilesystem
when you log in.  All file operations should work as usual, and you should
be able to create files owned by multiple different users and have those
ownerships preserved.

				Jeff



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

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

end of thread, other threads:[~2004-04-13  6:52 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-08  2:07 [uml-devel] A quick humfs HOWTO Jeff Dike
2004-04-08  6:25 ` Nuno Silva
2004-04-08  8:43   ` Henrik Nordstrom
2004-04-09 18:49     ` BlaisorBlade
2004-04-12 15:06     ` Michael Richardson
2004-04-13  6:51       ` Henrik Nordstrom
2004-04-12 15:05   ` Michael Richardson
2004-04-08  7:58 ` [uml-devel] Re: [uml-user] " Rus Foster
2004-04-08 11:23   ` Jeff Dike
2004-04-08  8:35 ` [uml-devel] " Henrik Nordstrom
2004-04-08 11:34   ` Jeff Dike
2004-04-08 12:09     ` Henrik Nordstrom
2004-04-08  9:54 ` Nick Craig-Wood
2004-04-08 10:07   ` Henrik Nordstrom
2004-04-08 11:41     ` Jeff Dike
2004-04-08 10:26   ` stian
2004-04-08 11:41   ` Jeff Dike
2004-04-08 12:52   ` Jeff Dike
2004-04-08 12:03 ` [uml-devel] " Gerd Knorr
2004-04-08 12:49   ` Jeff Dike
2004-04-08 13:01     ` Gerd Knorr
2004-04-08 13:49   ` Robin Green
2004-04-12 15:11   ` Michael Richardson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.