Home

Search this site:
 

Horshack’s
very
own site

 

This is Bavaria, Germany!
You will find links to Perl,
bootdisks for system administration,
a lot of Linux,
Windows administration
and some personal belongings.
Problems and Solutions with Debian

Create a vserver in a virtual disk

The vserver lives in one filesystem which is in a reality not a usual fs on your harddisk but one large file which is mounted like a partition.

Pro:

Con:

Create the disk and format it

Create the empty file and put an ext3fs filesystem onto it. Use /dev/zero, not /dev/null

/data/vdisks# dd bs=1024 if=/dev/zero of=lilliput count=700000

700000+0 records in
700000+0 records out

/data/vdisks# ls -lh
-rw-r--r--    1 root     root         684M Jul 31 03:18 lilliput

/data/vdisks# mke2fs lilliput
mke2fs 1.27 (8-Mar-2002)
lilliput is not a block special device.
Proceed anyway? (y,n) y
...

/data/vdisks# tune2fs -j lilliput
tune2fs 1.27 (8-Mar-2002)
Creating journal inode: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Mount it

/data/vdisks# mkdir /data/vservers/lilliput
/data/vdisks# mount -t ext3 /data/vdisks/lilliput /data/vservers/lilliput
mount: /data/vdisks/lilliput is not a block device (maybe try `-o loop'?)

/data/vservers# mount -o loop -t ext3 /data/vdisks/lilliput \
/data/vservers/lilliput


/data/vservers# mount
...
/data/vdisks/lilliput on /data/vservers/lilliput type ext3 (rw,loop=/dev/loop0)
/data/vservers# umount /data/vdisks/lilliput

If this works you can mount it automatically on startup of your system:

/data/vservers# vi /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>               <dump>  <pass>
...
/data/vdisks/lilliput   /data/vservers/lilliput   ext3  loop    0       2


lilliput:/data/vservers# mount /data/vdisks/lilliput
lilliput:/data/vservers# mount
...
/data/vdisks/lilliput on /data/vservers/lilliput type ext3 (rw,loop=/dev/loop0)

 

Impressum