8.5 Disk Filesystem over NFTL

We have already discussed the installation and use of NFTL with DOC devices in the previous chapter. We are now ready to discuss the use of a disk filesystem over the block device emulated by NFTL. The most widely used disk filesystem with NFTL is ext2. We will, therefore, concentrate on discussing that particular case. Note, however, that ext2 over NFTL does not provide power down reliability. For that, you should use a journalling filesystem, such as ext3, XFS, JFS, or reiserfs, with NFTL. The instructions that follow can be easily modified for any of the existing disk filesystems, including journalling filesystems.

First, create a filesystem on the designated NFTL partition for the selected filesystem type:

# mke2fs /dev/nftla1
mke2fs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
8160 inodes, 32574 blocks
1628 blocks (5.00%) reserved for the super user
First data block=1
4 block groups
8192 blocks per group, 8192 fragments per group
2040 inodes per group
Superblock backups stored on blocks:
        8193, 24577
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

Now, mount the partition and copy the root filesystem to it:

# mkdir /mnt/doc
# mount -t ext2 /dev/nftla1 /mnt/doc
# cp -a rootfs/* /mnt/doc

Here, I assume you are issuing these commands from your project's ${PRJROOT} directory. I also assume that the DOC device is accessible on your host as /dev/nftla, and that you want to create an ext2 filesystem on the first partition of that device. If the DOC device is not accessible on your host, use an NFS-mounted root filesystem as I describe in Section 8.2 to copy the content of the root filesystem onto your DOC device.