solaris tmpfs and ramdisk
1. tmpfsmkfs 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 blocks1209691 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 ->
../../devices/pseudo/ramdisk@1024:mydisk
-bash-3.00# ls -l /dev/rramdisk/mydisk
lrwxrwxrwx 1 root root 44 May 15 21:44 /dev/rramdisk/mydisk ->
../../devices/pseudo/ramdisk@1024:mydisk,raw
-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
页:
[1]