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

Tips: build a mini ext2 file system on a file



 
    
build a mini ext2 file system on a file:

[terrence@igloo install-linux]$ dd if=/dev/zero of=./rootfs bs=1k count=32768
32768+0 records in
32768+0 records out

[terrence@igloo install-linux]$ ls -al
total 32816
drwxr-xr-x    3 terrence terrence     4096 Jun 27 15:25 .
drwxr-xr-x   11 terrence terrence     4096 Jun 27 15:16 ..
-rw-r--r--    1 terrence terrence 33554432 Jun 27 15:25 rootfs

[terrence@igloo install-linux]$ /sbin/mkfs -t ext2 rootfs 
mke2fs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
rootfs is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
8192 inodes, 32768 blocks
1638 blocks (5.00%) reserved for the super user
First data block=1
4 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks: 
        8193, 24577

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

[root@igloo root]# mount -t ext2 -rw -o loop=/dev/loop1 ~terrence/projects/install-linux/rootfs /mnt/image/

[terrence@igloo install-linux]$ gzip -v9 rootfs 
rootfs:                  96.8% -- replaced with rootfs.gz

[terrence@igloo install-linux]$ dd if=rootfs.gz of=/dev/fd0


Google