File: UserModeLinux-HOWTO-8.html

package info (click to toggle)
user-mode-linux-doc 20060501-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,804 kB
  • sloc: sh: 275; makefile: 38
file content (111 lines) | stat: -rw-r--r-- 3,196 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
 <TITLE>User Mode Linux HOWTO : Creating filesystems</TITLE>
 <LINK HREF="UserModeLinux-HOWTO-9.html" REL=next>
 <LINK HREF="UserModeLinux-HOWTO-7.html" REL=previous>
 <LINK HREF="UserModeLinux-HOWTO.html#toc8" REL=contents>
</HEAD>
<BODY>
<A HREF="UserModeLinux-HOWTO-9.html">Next</A>
<A HREF="UserModeLinux-HOWTO-7.html">Previous</A>
<A HREF="UserModeLinux-HOWTO.html#toc8">Contents</A>
<HR>
<H2><A NAME="fs"></A> <A NAME="s8">8.</A> <A HREF="UserModeLinux-HOWTO.html#toc8">Creating filesystems</A></H2>

<P> 
You may want to create and mount new UML filesystems, either because
your root filesystem isn't large enough or because you want to use a
filesystem other than ext2.</P>
<P> 
This was written on the occasion of reiserfs being included in the
2.4.1 kernel pool, and therefore the 2.4.1 UML, so the examples will
talk about reiserfs.  This information is generic, and the examples
should be easy to translate to the filesystem of your choice.</P>

<H2><A NAME="ss8.1">8.1</A> <A HREF="UserModeLinux-HOWTO.html#toc8.1">Create the filesystem file</A>
</H2>

<P>dd is your friend.  All you need to do is tell dd to create an empty
file of the appropriate size.  I usually make it sparse to save time
and to avoid allocating disk space until it's actually used.  For
example, the following command will create a sparse 100 meg file full
of zeroes.
<BLOCKQUOTE><CODE>
<PRE>
host% 
dd if=/dev/zero of=new_filesystem seek=100 count=1 bs=1M
</PRE>
</CODE></BLOCKQUOTE>
</P>


<H2><A NAME="ss8.2">8.2</A> <A HREF="UserModeLinux-HOWTO.html#toc8.2">Assign the file to a UML device</A>
</H2>

<P>Add an argument like the following to the UML command line:
<BLOCKQUOTE><CODE>
<PRE>
 
ubd4=new_filesystem
</PRE>
</CODE></BLOCKQUOTE>

making sure that you use an unassigned ubd device number.</P>


<H2><A NAME="ss8.3">8.3</A> <A HREF="UserModeLinux-HOWTO.html#toc8.3">Creating and mounting the filesystem</A>
</H2>

<P>Make sure that the filesystem is available, either by being built into
the kernel, or available as a module, then boot up UML and log in.  If
the root filesystem doesn't have the filesystem utilities (mkfs, fsck,
etc), then get them into UML by way of the net or hostfs.</P>
<P> 
Make the new filesystem on the device assigned to the new file:
<BLOCKQUOTE><CODE>
<PRE>
host#  mkreiserfs /dev/ubd/4


&lt;----------- MKREISERFSv2 ----------->

ReiserFS version 3.6.25
Block size 4096 bytes
Block count 25856
Used blocks 8212
        Journal - 8192 blocks (18-8209), journal header is in block 8210
        Bitmaps: 17
        Root block 8211
Hash function "r5"
ATTENTION: ALL DATA WILL BE LOST ON '/dev/ubd/4'! (y/n)y
journal size 8192 (from 18)
Initializing journal - 0%....20%....40%....60%....80%....100%
Syncing..done.
</PRE>
</CODE></BLOCKQUOTE>

Now, mount it:
<BLOCKQUOTE><CODE>
<PRE>
UML# 
mount /dev/ubd/4 /mnt
</PRE>
</CODE></BLOCKQUOTE>

and you're in business.</P>








<HR>
<A HREF="UserModeLinux-HOWTO-9.html">Next</A>
<A HREF="UserModeLinux-HOWTO-7.html">Previous</A>
<A HREF="UserModeLinux-HOWTO.html#toc8">Contents</A>
</BODY>
</HTML>