A RAM disk is a portion of RAM which is used as if it were a hard disk. RAM disks have sizes that are established as a disk partition. Access times for a RAM disk are much faster than in a physical disk. However, any information stored in a ram disk is lost when the system shuts down or restarts. But they are a good place for temporary storage of data.
Since the version 2.4 of the Linux kernel can be found support for ramdisks, so you can find in any modern distro of linux. At the time of writing I am using Ubuntu 8.04 Hardy Heron with kernel 2.6.24-19-generic. Ubuntu and Debian autmontan RamDisk using tmpfs. This device is mounted on / dev / shm and is available to any user of the system. Ramdisk is dynamic by which automatically changes its size and can use up to half the ram available.
Support for RAM disks
By default Ubuntu has already created 16 discs ram, although not active or using any of our ram. Currently my system reports 768MB of ram, to verify or know how much memory has linux pc type:
fher98 @ betuntu: ~ $ free-m total used free shared buffers cached Mem: 748 729 19 0 50 304 - / + Buffers / cache: 374 374 Swap: 2180 173 2007
Using the command dmesg we can verify the size of ramdisks.
fher98 @ betuntu: ~ $ sudo dmesg | grep RAMDISK [sudo] password for fher98: [23.897741] RAMDISK driver initialized: 16 RAM disks of 65536k size 1024 blocksize
As we can see, Ramdisk size of the default is 64MB. Next, we'll see in the footsteps of Linux configuration to use a larger ramdisk during the booteo.
Increasing the capadicad ramdisk
The size of the RAM disk is defined by an option on the command line to the kernel at boot. Since it is the GRUB bootloader supported by default in Ubuntu are going to edit / boot / grub / menu.lst
fher98 @ betuntu: ~ $ sudo vim / boot / grub / menu.lst
We look for these lines in the file and add ramdisk_size = xxxxxx at the end of the line of the kernel.
| file: / boot / grub / menu.lst |
# # # # # # End Default Options Ubuntu 8.04.1 title, kernel 2.6.24-19-generic root (hd0, 0) kernel / boot/vmlinuz-2.6.24-19-generic root = UUID = e36ac08a-eba8-4cfa-baae-ro 61c9ca10e80a quiet splash initrd / boot/initrd.img-2.6.24-19-generic quiet |
Which = ramdisk_size xxxxxx is the size specified for the virtual disk. If we replace xxxxxx per 650,000 will have a 650MB disk.
After the amendment to file the line of the kernel should be like this:
| file: / boot / grub / menu.lst |
# # # # # # End Default Options Ubuntu 8.04.1 title, kernel 2.6.24-19-generic root (hd0, 0) kernel / boot/vmlinuz-2.6.24-19-generic root = UUID = e36ac08a-eba8-4cfa-baae-ro quiet 61c9ca10e80a ramdisk_size splash = 650000 initrd / boot/initrd.img-2.6.24-19-generic quiet |
It is necessary to reboot for the changes to the ramdisk (/ dev / ram) take effect.
Now that we have set the size of our disk is necessary to create the file system in / dev/ram0 then reassembled in order to save the arhivos.
fher98 @ betuntu: ~ $ sudo mke2fs / dev/ram0 fher98 @ betuntu: ~ $ cd / media / fher98 @ betuntu: ~ $ sudo mkdir ramdisk fher98 @ betuntu: ~ $ sudo mount / dev/ram0 / media / ramdisk / fher98 @ betuntu: ~ $ sudo chmod-R 777 ramdisk /
Popularity: 1% [?]
Trackback URI | Comments RSS






