Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Script to make RAM Disk' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Script to make RAM Disk
Authored by: klatt on Jan 28, '06 12:37:00PM
If you change
SizeInMB=128
to
SizeInMB=$1
you can enter the size in MB of the RAM disk you wish to create at the command line instead of having to change the script each time. Running it to create a 300 MB disk would be:
ramdisk.sh 300
So the changed script would be:
#!/bin/bash
VolumeName="RAMDisk"
SizeInMB=$1
NumSectors=$((2*1024*SizeInMB))
DeviceName=`hdid -nomount ram://$NumSectors`
echo $DeviceName
diskutil eraseVolume HFS+ RAMDisk $DeviceName


[ # ]