[Level 2] How to create ram disk?
If you want to create a RAM disk, you can use the command ramdiskadm.
The synopsis as the following:
/usr/sbin/ramdiskadm -a name size [g | m | k | b]
/usr/sbin/ramdiskadm -d name
/usr/sbin/ramdiskadm
The sample as the following:
Now, you can put the file in directory /mnt/ramdisk, the file will exists in RAM.
If you want to destroy it, the sample as following:
Wish this helps.
regards,
Stanley Huang
The synopsis as the following:
/usr/sbin/ramdiskadm -a name size [g | m | k | b]
/usr/sbin/ramdiskadm -d name
/usr/sbin/ramdiskadm
The sample as the following:
# ramdiskadm -a disk_a 128m
/dev/ramdisk/disk_a
# ls -l /dev/ramdisk/
total 1
lrwxrwxrwx 1 root root 40 2010-01-06 20:42 disk_a -> ../../devices/pseudo/ramdisk@1024:disk_a
lrwxrwxrwx 1 root root 40 2010-01-06 20:42 disk_a -> ../../devices/pseudo/ramdisk@1024:disk_a
# ls -al /dev/rramdisk/
total 1
lrwxrwxrwx 1 root root 44 2010-01-06 20:42 disk_a -> ../../devices/pseudo/ramdisk@1024:disk_a,raw
# newfs /dev/rramdisk/disk_a
newfs: construct a new file system /dev/rramdisk/disk_a: (y/n)? y
/dev/rramdisk/disk_a: 262036 sectors in 436 cylinders of 1 tracks, 601 sectors
127.9MB in 28 cyl groups (16 c/g, 4.70MB/g, 2240 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 9648, 19264, 28880, 38496, 48112, 57728, 67344, 76960, 86576,
173120, 182736, 192352, 201968, 211584, 221200, 230816, 240432, 250048, 259664
total 1
lrwxrwxrwx 1 root root 44 2010-01-06 20:42 disk_a -> ../../devices/pseudo/ramdisk@1024:disk_a,raw
# newfs /dev/rramdisk/disk_a
newfs: construct a new file system /dev/rramdisk/disk_a: (y/n)? y
/dev/rramdisk/disk_a: 262036 sectors in 436 cylinders of 1 tracks, 601 sectors
127.9MB in 28 cyl groups (16 c/g, 4.70MB/g, 2240 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
32, 9648, 19264, 28880, 38496, 48112, 57728, 67344, 76960, 86576,
173120, 182736, 192352, 201968, 211584, 221200, 230816, 240432, 250048, 259664
# mkdir -p /mnt/ramdisk
# mount /dev/ramdisk/disk_a /mnt/ramdisk
#
Now, you can put the file in directory /mnt/ramdisk, the file will exists in RAM.
If you want to destroy it, the sample as following:
# umount /mnt/ramdisk
# ramdisk -d /dev/ramdisk/disk_a
#
Wish this helps.
regards,
Stanley Huang
Comments
Post a Comment