Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How do I create a ramdisk?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 5282

PostPosted: Mon Sep 21, 2009 4:20 pm    Post subject: How do I create a ramdisk? Reply with quote

It was suggested to me that if I still get xruns after trying a certain number of things, I should try using a ramdisk to run my audio programs (such as Ardour). How do I create and use a ramdisk for this purpose?
_________________
Gentoo Studio: http://gentoostudio.org
Facebook: http://www.facebook.com/gentoostudio
G+: https://plus.google.com/113947758237122861689/posts
Pappy's Kernel Seeds: http://kernel-seeds.org
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3753
Location: sleeping in the bathtub

PostPosted: Mon Sep 21, 2009 4:35 pm    Post subject: Reply with quote

The easiest way is to enable ramdisk support via a module, and then supply the required parameters via modprobe, once you have the module built run `modinfo brd` to see the parameters.

Although, I'd imagine tmpfs would work just as well and would be less of a pain to set up, unless you think swapping is likely, in which case you probably don't have enough ram anyways.

Are they actually suggesting you copy ardour to a ramdisk and run it from there?
Once the program loads, I see very little benefit to this...
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
toralf
Advocate
Advocate


Joined: 01 Feb 2004
Posts: 2713
Location: Hamburg/Germany

PostPosted: Mon Sep 21, 2009 5:12 pm    Post subject: Reply with quote

Code:
mount -t tmpfs tmpfs /mnt/ramdisk -o noauto,user,size=660M
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 5282

PostPosted: Mon Sep 21, 2009 5:56 pm    Post subject: Reply with quote

Hopeless wrote:
The easiest way is to enable ramdisk support via a module, and then supply the required parameters via modprobe, once you have the module built run `modinfo brd` to see the parameters.

Although, I'd imagine tmpfs would work just as well and would be less of a pain to set up, unless you think swapping is likely, in which case you probably don't have enough ram anyways.

Are they actually suggesting you copy ardour to a ramdisk and run it from there?
Once the program loads, I see very little benefit to this...


Do you use Ardour? If you have any advice on avoiding xruns, I would tremendously appreciate it. On this same hardware, Windows and Sonar run smoothly. I'm trying to get permanently away from Windows.

Why would there be no benefit to running Ardour from a ramdisk (ramdisk noob)?
_________________
Gentoo Studio: http://gentoostudio.org
Facebook: http://www.facebook.com/gentoostudio
G+: https://plus.google.com/113947758237122861689/posts
Pappy's Kernel Seeds: http://kernel-seeds.org
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3753
Location: sleeping in the bathtub

PostPosted: Mon Sep 21, 2009 6:12 pm    Post subject: Reply with quote

No, I don't run ardour, sorry, but generally speaking the only benefit to loading a program from ram (be it tmpfs or a ramdisk) is faster (as in near-instantaneous) start up times.

I'd say look elsewhere for a solution, for one thing, are you using a realtime patched kernel?
(I know very little about this, but I do know it's recommended for audio work like you'd usually do with ardour).

What's your audio setup on linux like, anyway?
I mean what hardware, drivers, and jack setup (which I believe is recommended for ardour, if not mandatory).

And if you don't mind me asking, what are you actually using ardour for?
It's a very high grade app, but overkill for what most people need
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 7835
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Sep 21, 2009 6:27 pm    Post subject: Reply with quote

audiodef wrote:
Why would there be no benefit to running Ardour from a ramdisk (ramdisk noob)?
A tmpfs mount will swap long unused things out to swap drive if memory runs low. A ramfs mount will not. The equivalent mount is
Code:
mount -t ramfs -o noauto,user,size=660m ramfs /mnt/ramdisk
There's no need to use the old kernel ramdisk mechanism: no modules to build, load, or configure.

What is an "xrun"?

- John
_________________
This space intentionally left blank.
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 5282

PostPosted: Mon Sep 21, 2009 6:32 pm    Post subject: Reply with quote

Neat avatar, btw, Hopeless. 8)

I think my sampling rate in qjackctl might have been the culprit. I have two Mackie Onyx mixers with firewire and they are capable of 92khz. I had jack set for 48. I just turned it down to 44.1 and have not gotten an xrun in the amount of time it normally takes at least one to appear. We'll see, though.

Don't mind your asking at all. 8)

I'm a full-time musician who is fed up with Windows. It works, and it works well, but I have to jump through some hoops to turn on my equipment, sometimes more than once. Under my setup in Gentoo, I can just turn it on and go (and now hopefully I've nabbed the xruns problem. I don't mind 44.1).

I do use rt-sources, and I've had a little gracious assistance from Pappy (he's on these forums if you're not familiar with his name) tweaking the kernel. I'm trying to get set up to use Ardour for my final mixing and mastering processing. There are other programs, but none as full-featured as Ardour that I'm happy with. For MIDI, obviously, I need to look elsewhere. I've heard, though, that Ardour plans to implement full MIDI control in version 3.

You can check out my work, if you'd like, through the links in my sig. I'm REALLY hoping to create remixes of my latest single, Trust, using my Gentoo setup.

It's kind of a current mini-dream of mine to release an entire album and be able to say I did it in all in Linux.

Shoot, just saw an xrun appear in the qjackctl messages window. Still less than previous. I'll play with the buffers and periods.
_________________
Gentoo Studio: http://gentoostudio.org
Facebook: http://www.facebook.com/gentoostudio
G+: https://plus.google.com/113947758237122861689/posts
Pappy's Kernel Seeds: http://kernel-seeds.org
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3753
Location: sleeping in the bathtub

PostPosted: Mon Sep 21, 2009 6:42 pm    Post subject: Reply with quote

john_r_graham wrote:
audiodef wrote:
Why would there be no benefit to running Ardour from a ramdisk (ramdisk noob)?
A tmpfs mount will swap long unused things out to swap drive if memory runs low. A ramfs mount will not. The equivalent mount is
Code:
mount -t ramfs -o noauto,user,size=660m ramfs /mnt/ramdisk
There's no need to use the old kernel ramdisk mechanism: no modules to build, load, or configure.
The problem with ramfs is that there are no limits, the size option will actually be ignored, as as it can't be swapped out you can very easily consume all memory (and even OOM killer won't be able to help you).

That's why tmpfs is a better solution, and if you don't want swapping either `swapoff`, or set "/proc/sys/vm/swappiness" to something quite low.
Alternatively, you can use a real ramdisk, which will never be swapped and won't grow beyond the size you create it as, however you need to create a real filesystem upon it, and you can't reclaim memory by deleting files from it, only by destroying the ramdisk when finished with it.
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 5282

PostPosted: Mon Sep 21, 2009 8:03 pm    Post subject: Reply with quote

Thanks, John and toralf. I appreciate the input. 8)

Hopeless, I think I'm on the right track adjusting my jack settings and allowing the latency to ratchet up slightly. It looks like I can skip the ramdisk idea, but I'm going to keep all this info handy for other purposes.

:)
_________________
Gentoo Studio: http://gentoostudio.org
Facebook: http://www.facebook.com/gentoostudio
G+: https://plus.google.com/113947758237122861689/posts
Pappy's Kernel Seeds: http://kernel-seeds.org
Back to top
View user's profile Send private message
st.emsee
n00b
n00b


Joined: 22 Jun 2013
Posts: 1

PostPosted: Sat Jun 22, 2013 10:06 am    Post subject: ramdisk persist with manual save to disk scripts for ardour Reply with quote

I did this on lighthouse64 puppy linux for persistent ramdisk, the scripts can be called by rsync and cron if need be
edit /etc/rc.local
add lines;

mke2fs -t ext2 /dev/ram1 2048000
mount /dev/ram1 /home/ramdisksave

this formats 2gb ramdisk at boot...change for 1gb or 4gb 1024000 or 4096000 respectively. Then it mounts ramdisk at '/home/ramdisksave' or 'mkdir /'your choice/'your choice' and mount it there.

you will need to add to grub after kernel 'ramdisksk_size=2048000' or whatever max ramdisk size you require.

next after login in term create a ramdisk save directory on harddisk
mkdir /home/ramdisksave

next open a text editor - geany - gedit - or leafpad, open new. Type;

#copies ramdisksave contents to ramdisk
cp -a /home/ramdisksave/. /mnt/ram1

save as 'copy to ramdisk.sh' in /home folder; then change permissions to make executable. then create symlink on your desktop.
next in editor open another new, Type;

#saves ramdisk contents to ramdisksave folder
cp -a /mnt/ram1/. /home/ramdisksave/

save as 'save ramdisk to HD.sh' in /home folder; change permissions to executable. Then create symlink to desktop.

Now you have a ramdisk created and mounted at boot and scripts to load and save ramdisk contents making it a quasi-persistent ramdisk. You could also add script texts to rc.shutdown and rc.sysinit to occur at startup and shutdown irrespectively! However the option to perform these tasks manually at will is reassuring. Two more scripts could be written to delete contents 1) of ramdisk 2) of ramdisk save

#deletes ramdisk contents
cd /mnt && rm -rf ram1/*

save as .......make exe......symlink

#deletes ramdisksave contents
cd /home && rm -rf ramdisksave/*

save as .......make exe......symlink

so to abbreviate:

#create ramdisksave directory using terminal...
mkdir /home/ramdisksave

#edit grub config or custom_40. This allocates max ram for ramdisks...if you make more than one ramdisk they must share the total allocation....
kernel /vmlinuz ramdisk_size=2048000

#edit rc.local add to create & mount ramdisk at boot...
mke2fs -t ext2 /dev/ram1 2048000
mount /dev/ram1 /home/ramdisksave

#copies ramdisksave contents to ramdisk save as *.sh make exe!
cp -a /home/ramdisksave/. /mnt/ram1

#saves ramdisk contents to ramdisksave folder save as *.sh make exe!
cp -a /mnt/ram1/. /home/ramdisksave/

#deletes ramdisk contents save as *.sh make exe!
cd /mnt && rm -rf ram1/*

#deletes ramdisksave contents save as *.sh make exe!
cd /home && rm -rf ramdisksave/*


I will make a gui for this with more options.
Back to top
View user's profile Send private message
_______0
Guru
Guru


Joined: 15 Oct 2012
Posts: 521

PostPosted: Sun Jun 23, 2013 1:59 pm    Post subject: Reply with quote

hi,

to avoid xruns your ramdisk solution alone is not gonna be enough.

To set up an audio workstation there are several steps and various things to take into consideration. I suggest reading plenty about it.

Some tips I can give you are the following:


1 rt-kernel

2 nework, audio, graphics card ON THEIR OWN irq:

cat /proc/interrupts

modprobe stuff with msi irq enabled.

3 set up real time limits/permissions properly.

4 set up irq priorities. You should double check jack processes that have the proper prios, I notice if I kill jack and restart it the new processes have default prios.

5 boost PCI bus speeds in:

/etc/conf.d/pciparm

6 experiment with different jackd buffers:

-p 128 -n 2

The above ones are supposed to be good for low latency (according to man pages)

7 disable all non-essential stuff in bios like parallel, serial, floppy. I noticed that even virtualization can interfere with a low latency set up.

That's the list from top of my head, there's prolly more things.

Also if you want concrete help you should provide logs related to sound set up.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum