[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Experience with initrd and loop devices (script included)

Francesco Potorti` wrote:
> I started building an initrd image for use with loadlin and md (I
> wanto to put everything under raid-0).  As first step, I needed the
> image of an ext2 (or whatever) file system to mount via loopback
> device, in order to put into it all the necessary modules and so on.
> First, I realised that, if any docs exist on how to use the loopback
> device, they are well hidden.  Hints are found in the mount man page
> and in the Bootdisk-HOWTO, but nothing general enough.
> Indeed, everyone assumes that you have an image and want to mount it,
> but nothing is said about what to do to *create* an image from
> scratch.  Well, the Bootdisk-HOWTO says how to do, but it does not
> work...  It says that you just need to do
>         dd if=/dev/zero of=/tmp/fsfile bs=1k count=nnn
>         mount -o loop -t ext2 /tmp/fsfile /mnt

Naturally that won't work since /tmp/fsfile is just full of zeros.
Look at the man page for "mke2fs". The following worked fine for me
(I couldn't mount since my kernel doesn't support loop-back at this
time). (NOTE: the '-F' forces mke2fs to continue even though ~/fs
is not a block device.)

chilin$ dd if=/dev/zero of=~/fs bs=1024 count=1024
1024+0 records in
1024+0 records out
chilin$ mke2fs -F ~/fs
mke2fs 1.10, 24-Apr-97 for EXT2 FS 0.5b, 95/08/09
Linux ext2 filesystem format
Filesystem label=
256 inodes, 1024 blocks
51 blocks (4.98%) reserved for the super user
First data block=1
Block size=1024 (log=0)
Fragment size=1024 (log=0)
1 block group
8192 blocks per group, 8192 fragments per group
256 inodes per group

Writing inode tables: done
Writing superblocks and filesystem accounting information: done
chilin$ file ~/fs
/home/jbj1/fs: Linux/i386 ext2 filesystem

Jens B. Jorgensen

TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .

Reply to: