Difference between revisions of "How to create ramdisk file"

From HyperSecurity Wiki
Jump to: navigation, search
(No difference)

Revision as of 17:47, 15 June 2016

Create the file. Replace filesize with 1024xsize:

dd if=/dev/zero of=initrdfs bs=1k count=filesize

Make a file system:

mke2fs -N 1024 initrdfs

Create a mount directory as root:

mkdir /mnt/initrdfs

Mount filesystem as root:

mount -o loop initrdfs /mnt/initrdfs

Copy needed files to /mnt/initrdfs

Umount it and compress:

umount /mnt/initrdfs
gzip -9c initrdfs > initrd.img

Now you have a functional ramdisk.

Source: http://lists.busybox.net/pipermail/busybox/2004-September/046827.html