LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   create ramdisk in slack 14 ? (http://www.linuxquestions.org/questions/slackware-14/create-ramdisk-in-slack-14-a-4175488649/)

WiseDraco 12-20-2013 03:26 AM

create ramdisk in slack 14 ?
 
Hello!
Maybe anyone have an instruction, why i can create a ramdisk on slackware64 14.0, and use it as a "normal" disk partition?
thanks...

fietser 12-20-2013 03:34 AM

https://www.google.nl/search?q=creat...HaiO0AWjpoC4Dg

Have fun.

TobiSGD 12-20-2013 08:38 AM

Just use a tmpfs, for example with
Code:

mount -t tmpfs tmpfs /mnt/ramdisk
This filesystem in RAM will always only occupy only the space that is actually used. By default it is limited to half the size of your RAM, but you can change that with the size mount option.

MadMaverick9 12-20-2013 09:19 PM

Why create something that already exists?
Code:

df -h | grep tmpfs
tmpfs          1,5G  12K  1,5G  1% /dev/shm


TobiSGD 12-21-2013 11:24 PM

Quote:

Originally Posted by MadMaverick9 (Post 5084857)
Why create something that already exists?
Code:

df -h | grep tmpfs
tmpfs          1,5G  12K  1,5G  1% /dev/shm


/dev/shm has a very specific purpose (providing shared memory for inter-process communication). It makes sense to not use it for a different purpose, but rather to separate different use-cases, especially when it comes with virtually no costs to do so.

WiseDraco 12-28-2013 01:55 AM

Quote:

Originally Posted by TobiSGD (Post 5084499)
Just use a tmpfs, for example with
Code:

mount -t tmpfs tmpfs /mnt/ramdisk
This filesystem in RAM will always only occupy only the space that is actually used. By default it is limited to half the size of your RAM, but you can change that with the size mount option.

currently i use a addition to "append="... ramdisk_size=8192000" in lilo.conf, and

mkfs-t ext2 -q /dev/ram1 8192000
mount /dev/ram1 /mnt/ramdisk

in rc.local


why tmpfs is better than this?
i have a 16 Gb RAm on that machine, and 8 Gb ramdisk is sufficient for my purposes.
also, maybe anyone can explain, in what ways /dev/ram0 differ from /dev/ram1 / ram2 and so on?

wildwizard 12-28-2013 02:21 AM

tmpfs/ramfs will be faster than the old (ramdisk) code, see here :-

https://www.kernel.org/doc/Documenta...-initramfs.txt

tmpfs and ramfs work the same way but have minor differences

eg :-
ramfs can grow
tmpfs can be swapped


tl;dr

ramdisk - old bad
ramfs/tmpfs - new good

WiseDraco 12-28-2013 07:09 AM

Quote:

Originally Posted by wildwizard (Post 5087955)
tmpfs/ramfs will be faster than the old (ramdisk) code, see here :-

https://www.kernel.org/doc/Documenta...-initramfs.txt

tmpfs and ramfs work the same way but have minor differences

eg :-
ramfs can grow
tmpfs can be swapped


tl;dr

ramdisk - old bad
ramfs/tmpfs - new good

ok, thanks for clarification and some fun :)
but what way i can use tmpfs? i must mount /dev/shm to /mnt/ramdisk or so on?

TobiSGD 12-28-2013 07:39 AM

No, you don't mount /dev/shm. /dev/shm has a very specific purpose and I wouldn't use it for other things. You can just mount a new tmpfs (tmpfs is a virtual filesystem) to any directory you want. For example, on my main machine I mount a tmpfs to /tmp on boot, so that all actions in /tmp automatically run on a RAM-disk.

jpollard 12-28-2013 08:14 AM

The only downside I know of with tmpfs is that there are no quota controls possible on it.

A user/process may fill tmpfs using up the amount of memory the mount is limited to (1/2 ram by default).

Using several such mounts allows a DOS attack (inadvertent OOM) that can't be avoided.

Fedora uses a tmpfs for /run - filling that filesystem causes services to fail, login failures, and OOM failures.

It is sort of reasonable for workstations, but very limited for servers (the use for shared memory is the only reasonable use I know of) as it allows users the ability to wipe out the usability of the system.

jtsn 12-28-2013 08:58 AM

Quote:

Originally Posted by jpollard (Post 5088051)
Fedora uses a tmpfs for /run

Slackware too. It doesn't show up in /etc/mtab, but just have a look at /proc/mounts.

Quote:

filling that filesystem causes services to fail, login failures, and OOM failures
That's what you can expect from quality Red Hat software.

jpollard 12-28-2013 11:22 AM

Quote:

Originally Posted by jtsn (Post 5088069)
Slackware too. It doesn't show up in /etc/mtab, but just have a look at /proc/mounts.

I don't see it... /run is part of my root filesystem. Second, no user can write to /run anyway.
Quote:

That's what you can expect from quality Red Hat software.
I don't blame RH for that one (yet, I haven't tested their beta release). Some of their developers are a group of prima donnas in that even though they don't understand servers, that whatever they do is appropriate. They are also a bit ignorant of past technology... network analysis tools for ordering went out back in the 80s due to combinatorial explosion in complexity. Yet, they think they can get it to work reliably, and have foisted off an inherently unreliable init system.

jtsn 12-28-2013 01:03 PM

Quote:

Originally Posted by jpollard (Post 5088119)
I don't see it... /run is part of my root filesystem. Second, no user can write to /run anyway.

The mount is done in /etc/rc.d/rc.S:
Code:

# If /run exists, mount a tmpfs on it (unless the
# initrd has already done so):
if [ -d /run ]; then
  if ! grep -wq "tmpfs /run tmpfs" /proc/mounts ; then
    /sbin/mount -v -n -t tmpfs tmpfs /run -o mode=0755
  fi
fi

Quote:

I don't blame RH for that one (yet, I haven't tested their beta release). Some of their developers are a group of prima donnas in that even though they don't understand servers, that whatever they do is appropriate.
As a business they are as successful as Microsoft in their respective field. You just do not need well-designed software from able developers to pull that off, that may even stand in the way of that business model.

Quote:

They are also a bit ignorant of past technology... network analysis tools for ordering went out back in the 80s due to combinatorial explosion in complexity. Yet, they think they can get it to work reliably, and have foisted off an inherently unreliable init system.
That is why stopped following the whole "technology" buzz (with programming language/framework of the week) and stay with Slackware (to get back on topic here). Some IT people think they can live without heritage, but IMHO making up stuff ad-hoc all the time is not a reputable profession. So one has to decide if he is either ignorant of the past or an IT professional. One can't be both.

jpollard 12-29-2013 07:10 AM

Quote:

Originally Posted by jtsn (Post 5088163)
The mount is done in /etc/rc.d/rc.S:
Code:

# If /run exists, mount a tmpfs on it (unless the
# initrd has already done so):
if [ -d /run ]; then
  if ! grep -wq "tmpfs /run tmpfs" /proc/mounts ; then
    /sbin/mount -v -n -t tmpfs tmpfs /run -o mode=0755
  fi
fi


Got it. At least slakware doesn't allow any user process access to it. That is where the problem lies.

Slackware is using /var/run (part of /var which is root) for what RH uses /run.

Quote:

As a business they are as successful as Microsoft in their respective field. You just do not need well-designed software from able developers to pull that off, that may even stand in the way of that business model.
I have no problem with some of what they do. SELinux, for instance, is a good thing to use to isolate one service from another, and from users. I'm not fond of the use of cgroups. There are good aspects, but also some bad side effects.
Quote:


That is why stopped following the whole "technology" buzz (with programming language/framework of the week) and stay with Slackware (to get back on topic here). Some IT people think they can live without heritage, but IMHO making up stuff ad-hoc all the time is not a reputable profession. So one has to decide if he is either ignorant of the past or an IT professional. One can't be both.
I intend to stay with slackware myself. I have been using RH/Fedora because that is what the workplace used. But I have been migrating back...


All times are GMT -5. The time now is 08:18 AM.