Creating and Overview of Linux initial RAM disk (initrd)

A main function of a RAM disk is to keep the application caching folder, log files, or temporary data. There are two main types of RAM Disk, which are used in Linux.

(1)ramfs
(2)tmpfs

Create a folder to use as a mount point for your RAM disk.

 mkdir /ramdisk 

Use the mount command to use create a ram disk and mount. The below command will mount temporarily, we can use also /etc/fstab for permanent mounting.

Syntax:

 mount -t [TYPE] -o size=[SIZE] [FSTYPE] [MOUNTPOINT]

For example below :

mount -t tmpfs -o size=256M tmpfs /ramdisk 

[TYPE] RAM disk type.
[SIZE] is the size to use for the file system.
[FSTYPE] Type of RAM disk to use.

Example

mount -t tmpfs -o size=256M tmpfs /ramdisk

If you have to make it available after reboot then you can edit the /etc/fstab files and add below the following line:

 tmpfs /ramdisk      tmpfs   size=256M,mode=0777     0   0

In the example [TYPE] of the ramdisk, the size of the Ramdisk will be used for the ramdisk. type of ram disk like ext4, ext3, ext4 ,xfs tmpfs.

About Sachin G

I am a professional freelance contributor and founder of tech transit. Love to write and lover of education, culture, and community. I have been using it, setting, supporting, and maintaining it since 2009.Linux rocks!

Have any Question or Comment?

2 comments on “Creating and Overview of Linux initial RAM disk (initrd)

Johng120

Oh my goodness! an amazing article dude. Thanks Nonetheless I am experiencing issue with ur rss . Dont know why Unable to subscribe to it. Is there anybody getting similar rss drawback? Anybody who is aware of kindly respond. Thnkx

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *