Knowledgebase
emscom > emscom Help Desk > Knowledgebase

Search help:


Build. Create Ram Disk

Solution

A Ram disk is can be useful for many purposes.  

In particular when creating a root fs during the building of a boot image.

To create a 4MB Ext2 Ram disk

1. Check that /dev/ram0 exists, or create the device file using mknod

2. Zero the device with, dd if=/dev/zero of=/dev/ram0 bs=1k count=4096

3. Create the file system with, mke2fs -m 0 -N 2000 /dev/ram0

The ramdisk can now be mounted with, mount -t ext2 /dev/ram0 /mnt

 

4Mb may not be sufficient to build a modern Linux root fs.  The ramdisk can be resized, after dismounting.  Resizing will destroy the data on the device.

To create a 10MB Ex2 Ram disk

dd if=/dev/zero of=/dev/ram0 bs=1k count=10240

mk2fs -m 0 -N 4000 /dev/ram0

The resized ramdisk can now be mounted.

Notes: -m is the reserved space. -N 4000 specifies 4000 inodes.  An inode is roughly equivalent to a file or folder entry in a file allocation table.  A filesystem containing mainly small files, will required more inodes than a filesystem containing a few large files.

 
Was this article helpful? yes / no
Related articles OSX Rescue Files fom non-booting system
Win7 USB Flash Drive Install
ESXi consolidate space on thin disk
Build. Align partition
Article details
Article ID: 57
Category: Linux
Date added: 14-03-2014 06:29:06
Views: 207
Rating (Votes): Article rated 3.0/5.0 (8)

 
« Go back

 
Powered by Help Desk Software HESK, in partnership with SysAid Technologies