Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

philgxxd

macrumors 6502
Original poster
Feb 11, 2017
424
342
Malaga, Spain
Hi.
As I have put 16gb of RAM in my G5 quad I wanted to try to make use of it making a RAM disk.

I plan to follow the article from Dr.Kaiser of TFF but I'm stuck as I don't know anything about scripts.

I thought I can just type the commands into the terminal but it seems that is not the approach.

Can someone guide me of what to do exactly?
 
The % in front of the cat command is confusing me. I can't find any reference online where this gets used.
I now think that maybe the first line is just for calling the command from the terminal BUT it first has to be there (the path) so maybe I have to write a script and to put it there. The script actually starting with the second line?
 
Yes , it starts at
#!/bin/sh

---

% cat ~/bin/ramdisk

is the cmd to show the content of "ramdisk" file which is the script that is in a "bin" folder in your user folder , and starts with "#!/bin/sh".
 
Last edited:
The % is just the shell's prompt indicating that it's waiting for commands to be typed.

Shell scripts are simple text files containing terminal commands that will be run one after another when the script is executed. You can also type the commands listed in the scripts directly.

The ~/bin/ramdisk script (~ points to your home folder) sets up the RAM disks and combines them by running

Code:
#!/bin/sh

/bin/test -e /Volumes/BigRAM && exit

diskutil erasevolume HFS+ r1 \
        `hdiutil attach -nomount ram://4629672` &
diskutil erasevolume HFS+ r2 \
        `hdiutil attach -nomount ram://4629672` &
diskutil erasevolume HFS+ r3 \
        `hdiutil attach -nomount ram://4629672` &
diskutil erasevolume HFS+ r4 \
        `hdiutil attach -nomount ram://4629672` &
wait
diskutil createRAID stripe BigRAM HFS+ \
        /Volumes/r1 /Volumes/r2 /Volumes/r3 /Volumes/r4

The other (~/bin/noramdisk) unmounts the RAM disk by running

Code:
#!/bin/sh

/bin/test -e /Volumes/BigRAM || exit

diskutil unmountDisk /Volumes/BigRAM
diskutil checkRAID BigRAM | tail -5 | head -4 | \
        cut -c 3-10 | grep -v 'Unknown' | \
        sed 's/s3//' | xargs -n 1 diskutil eject

You can create these scripts using a simple text editor and afterwards, make them executable (if you don't, the shell won't run them) by running

Code:
chmod +x ~/bin/ramdisk
chmod +x ~/bin/noramdisk

this requires that both scripts have been saved in a "bin" folder under your home folder which is /Users/YourUserName. If you put them somewhere else, the path needs to be adjusted accordingly.
 
  • Like
Reactions: philgxxd
Hi.
As I have put 16gb of RAM in my G5 quad I wanted to try to make use of it making a RAM disk.

I plan to follow the article from Dr.Kaiser of TFF but I'm stuck as I don't know anything about scripts.

I thought I can just type the commands into the terminal but it seems that is not the approach.

Can someone guide me of what to do exactly?
Complicated…

Are you aware of Ram Disk Creator?


Of course there is Esperance DV as mentioned in the linked thread.

The Universal Build of Ram Disk Creator works on my Quad. Note, you will run into the same 2GB limit issue that Kaiser mentions. But the OP of the thread mentions a way around this (which I just tried), in post 25: https://forums.macrumors.com/threads/ram-disk-creator.1708750/?post=18805970#post-18805970

That's one terminal command…

You'd have to create the separate ram disks first and then run the terminal command and I imagine that the scripting you want to do would be easier after setup but this to me is an easier method.
 
You'd have to create the separate ram disks first and then run the terminal command and I imagine that the scripting you want to do would be easier after setup but this to me is an easier method.
Kaiser's script does just that - it creates four RAM disks and stripes them. 🙂
 
Kaiser's script does just that - it creates four RAM disks and stripes them. 🙂
Right.

But I can create ram disks using Ram Disk Creator and then execute one terminal command.

It requires that I open Ram Disk Creator to do that, but to me it's easier to just click on "Create RAM Disk".

Although I may try his script in the future.

Right now I've got an 8GB RAM disk sitting on my desktop, created by Ram Disk Creator and raiding the disks using that command.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.