본문 바로가기

맥/MacOSX

[TIP] 램디스크 생성

ramfs ram filesystem can be created under Mac OS X as follows:
# hdid -nomount ram://1024 /dev/disk3
he above command creates a ram disk with 1024 sectors (sector size being 512), and prints the name of the resultant device on the standard output. Thereafter, a filesystem can be created on this device (the corresponding raw device, technically) as follows:
# newfs_msdos /dev/rdisk3 /dev/rdisk3: 985 sectors in 985 FAT12 clusters \ (512 bytes/cluster) \ bps=512 spc=1 res=1 nft=2 rde=512 sec=1024 mid=0xf0 \ spf=3 spt=32 hds=16 hid=0
he disk can be mounted as usual:
# mount -t msdos /dev/disk3 /tmp/msdos # mount /dev/disk3 on /private/tmp/msdos (local) # df /tmp/msdos Filesystem 512-blocks Used Avail Capacity Mounted on /dev/disk3 987 2 985 0% /private/tmp/msdos
inally, you can get rid of the ram disk as follows:
# hdiutil detach /dev/disk3 "disk3" unmounted. "disk3" ejected.