Example 12-4 : Applying prtvtoc to a RAM Drive of 2 MB
# prtvtoc /dev/ramchr0 ramdrive open: flag 1 copen 1 bopen 0 xopen 0 DIOCGETVH on 20185088 ioctl copy kmem 8841f604 -> usr 10006868 for 512 ramdrive close: flag 1 copen 0 bopen 0 xopen 0 * /dev/ramchr0 (bootfile "") * 512 bytes/sector * 8 sectors/track * 1 tracks/cylinder * 512 cylinders * 0 cylinders occupied by header * 512 accessible cylinders * No space unallocated to partitions Partition Type Fs Start: sec (cyl) Size: sec (cyl) Mount Directory 0 raw 1 ( 0.1) 4095 ( 511.9) 7 raw 1 ( 0.1) 4095 ( 511.9) 8 volhdr 0 ( 0) 1 ( 0.1) 10 volume 0 ( 0) 4096 ( 512)You can make an EFS filesystem on a RAM drive device by applying mkfs to the character special device (mkfs is applied to the character device because it uses ioctl(), which is not supported for block devices). This is shown in Example 12-5. The voluminous debugging displays have been truncated in the display.
Example 12-5 : Making a Filesystem on a RAM Drive
# mkfs -t efs /dev/ramchr0 ramdrive open: flag 1 copen 1 bopen 0 xopen 0 DIOCGETVH on 20185088 ioctl copy kmem 8841f604 -> usr 10010c50 for 512 ramdrive close: flag 1 copen 0 bopen 0 xopen 0 ramdrive open: flag 1 copen 1 bopen 0 xopen 0 DIOCGETVH on 20185088 ioctl copy kmem 8841f604 -> usr 10010c50 for 512 ramdrive close: flag 1 copen 0 bopen 0 xopen 0 ramdrive open: flag 1 copen 1 bopen 0 xopen 0 DIOCGETVH on 20185088 ioctl copy kmem 8841f604 -> usr 10010c50 for 512 ramdrive close: flag 1 copen 0 bopen 0 xopen 0 ramdrive open: flag 1 copen 1 bopen 0 xopen 0 ramdrive close: flag 1 copen 0 bopen 0 xopen 0 ramdrive open: flag 3 copen 1 bopen 0 xopen 0 mkfs_efs: /dev/ramchr0: blocks=4095 inodes=616 mkfs_efs: /dev/ramchr0: sectors=8 cgfsize=4091 mkfs_efs: /dev/ramchr0: cgalign=1 ialign=1 ncg=1 mkfs_efs: /dev/ramchr0: firstcg=3 cgisize=154 mkfs_efs: /dev/ramchr0: bitmap blocks=1 rd_write entered for dev 20185088 rd_strategy: edev 20185088, flags 8018, blkno 3 : offset 600, count 13400, dmaadr c026b610 : write c026b610 to c0000600 for 13400 rd_write entered for dev 20185088 rd_strategy: edev 20185088, flags 18, blkno 0 : offset 0, count 200, dmaadr 8b292cc0 : write 8b292cc0 to c0000000 for 200 rd_read entered for dev 20185088 rd_strategy: edev 20185088, flags 19, blkno 3 : offset 600, count 200, dmaadr c2c38a40 : read c0000600 to c2c38a40 for 200 (many debugging displays omitted) rd_write entered for dev 20185088 rd_strategy: edev 20185088, flags 8018, blkno ffe : offset 1ffc00, count 200, dmaadr c022def0 : write c022def0 to c01ffc00 for 200 ramdrive close: flag 3 copen 0 bopen 0 xopen 0After making a filesystem you can mount the filesystem, as shown in Example 12-6. You specify the block device when mounting an EFS filesystem, because the filesystem code calls the pfxsize() and pfxstrategy() driver entry points, which are supplied only by a block driver.
Example 12-6 : Mounting a RAM Drive Filesystem
# mount -t efs /dev/ramblk0 /RAM0 ramdrive open: flag 3 copen 0 bopen 1 xopen 0 rd_size entered for dev 20185088 rd_strategy: edev 20185088, flags 9, blkno 1 : offset 200, count 200, dmaadr 889f5800 : read c0000200 to 889f5800 for 200 rd_strategy: edev 20185088, flags 9, blkno 2 : offset 400, count 200, dmaadr 889f5a00 : read c0000400 to 889f5a00 for 200 rd_strategy: edev 20185088, flags 8, blkno 2 : offset 400, count 200, dmaadr 889f5a00 : write 889f5a00 to c0000400 for 200 rd_strategy: edev 20185088, flags 9, blkno 3 : offset 600, count 1000, dmaadr 88ef6000 : read c0000600 to 88ef6000 for 1000 rd_strategy: edev 20185088, flags 1000008, blkno 1 : offset 200, count 200, dmaadr 889f5800 : write 889f5800 to c0000200 for 200 # df /RAM0 Filesystem Type blocks use avail %use Mounted on /dev/ramblk0 efs 3937 22 3915 1 /RAM0