免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1800 | 回复: 0
打印 上一主题 下一主题

solaris tmpfs and ramdisk [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-05-16 13:18 |只看该作者 |倒序浏览
1. tmpfs
mkfs is not needed for tmpfs which could be mounted directly.
-bash-3.00# mount -F tmpfs -o size=10m ram0 /ram/ram0/
-bash-3.00# mount -F tmpfs -o size=10k ram1 /ram/ram1/
-bash-3.00# df
/                  (/dev/dsk/c0d0s0   ):19079496 blocks  1209691 files
/ram/ram0          (swap              ):   20480 blocks    92297 files
/ram/ram1          (swap              ):      24 blocks    92297 files


2. ramdisk
ramdisk is a block driver in the kernel.A single character device node is used by ramdiskadm(1M) to communicate with the ramdisk driver.
  /dev/ramdiskctl -> /devices/pseudo/ramdisk@0:ctl

-bash-3.00# ramdiskadm -a mydisk 1m
/dev/ramdisk/mydisk
-bash-3.00# ls -l /dev/ramdisk/mydisk
lrwxrwxrwx   1 root     root          40 May 15 21:44 /dev/ramdisk/mydisk ->
[email=../../devices/pseudo/ramdisk@1024:mydisk]../../devices/pseudo/ramdisk@1024:mydisk[/email]
-bash-3.00# ls -l /dev/rramdisk/mydisk
lrwxrwxrwx   1 root     root          44 May 15 21:44 /dev/rramdisk/mydisk ->
[email=../../devices/pseudo/ramdisk@1024:mydisk,raw]../../devices/pseudo/ramdisk@1024:mydisk,raw[/email]
-bash-3.00# ls -l /devices/pseudo/ramdisk\@1024*
crw-r--r--   1 root     sys       70,  0 May 15 21:34 /devices/pseudo/ramdisk@1024:ctl
brw-------   1 root     sys       70,  1 May 15 21:44 /devices/pseudo/ramdisk@1024:mydisk
crw-------   1 root     sys       70,  1 May 15 23:10 /devices/pseudo/ramdisk@1024:mydisk,raw

when use mkfs, something wrong happened.

-bash-3.00# mkfs -F ufs /dev/ramdisk/mydisk 1024
Can not determine partition size: Inappropriate ioctl for device

but with newfs, it worked well.
-bash-3.00# newfs /dev/ramdisk/mydisk
newfs: construct a new file system /dev/rramdisk/mydisk: (y/n)? y
/dev/rramdisk/mydisk:   30702 sectors in 51 cylinders of 1 tracks, 602 sectors
        15.0MB in 4 cyl groups (16 c/g, 4.70MB/g, 2240 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 9664, 19296, 28928,
-bash-3.00# mount /dev/ramdisk/mydisk /mnt/
-bash-3.00# ls /mnt/
lost+found

The ramdisk worked.

now change the device with mkfs.
-bash-3.00# mkfs -F ufs /dev/rramdisk/mydisk 1024
/dev/rramdisk/mydisk:   1024 sectors in 2 cylinders of 16 tracks, 32 sectors
        0.5MB in 1 cyl groups (16 c/g, 4.00MB/g, 1920 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32,

the file system has been setup. but when run mount, it was reported that,
-bash-3.00# mount /dev/ramdisk/mydisk /mnt/
/mnt: No space left on device

so use newfs, not mkfs for ramdisk on solaris 10.

-bash-3.00# mkfs -F ufs /devices/pseudo/ramdisk@1024:mydisk,raw 1024
can't check mount point; can't stat

3. about the driver
- newfs work on the char driver, read() and write() will be called.
- mount and file edit on the partition work on the block driver, strategy will be called.




本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/38597/showart_302334.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP