Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

While reading through the kernel documentation on ramdisk in ramfs-rootfs-initramfs.txt i was having a doubt like the ramdisk explained there is same as the initrd features described in the post at the-difference-between-initrd-and-initramfs.

Could someone clarify me on this??

And if it is the same, i read that there are many disadvantages for it, but still in my fedora PC, i see

initrd-2.6.29.4-167.fc11.i686.PAE.img

in my boot folder. Is it different from the initrd mentioned above??

UPDATE_EDIT :
In of the articles I even saw a command like
# update-initramfs -u all
update-initramfs: Generating /boot/initrd.img-2.6.18-5-amd64

So how is this initramfs linked to initrd.img ?

share|improve this question
add comment

1 Answer 1

up vote 8 down vote accepted

A ramdisk is a set of blocks that gets copied to an allocated chunk of memory, then treated as a block device. A normal filesystem is created on the ramdisk. The initrd (initial ramdisk) is a ramdisk that is mounted during bootup.

The initramfs is something different. It's a cpio archive of files that is loaded during bootup. The kernel loads the contents into a virtual filesystem it calls rootfs. Unlike a ramdisk, deleting files directly frees memory, and there's no extra filesystem and block layer involved.

Both methods result in files being available to the kernel at boot time before any devices have been loaded, and so in practice you can achieve similar results with both. Older systems use initrd (it was created before initramfs) but modern systems should all be using initramfs. You may still see the word initrd in reference to something that is really an initramfs; it's just naming for compatibility's sake.

share|improve this answer
    
Thanks ephemient, I would like to know what you meant by "ramdisk is a set of blocks". How is this treated as a block device once it has been copied? –  Sen Dec 8 '10 at 6:35
    
@Sen: There is a rd module (later renamed to brd, and may be built into the kernel), which allocates a bunch of memory, creates a block device, and maps requests to/from the block device into read/writes in memory. –  ephemient Dec 8 '10 at 6:40
    
Can you give me some more idea about this rd / brd module? –  Sen Dec 8 '10 at 7:10
    
i would also like to know that if i have created a ramdisk image by following these steps : mke2fs -vm0 /dev/ram 4096; mount -t ext2 /dev/ram /mnt; cd /mnt; cp /bin, /sbin, /etc, /dev ... files in mnt; cd ../; umount /mnt; dd if=/dev/ram bs=1k count=4096 of=ext2ramdisk; How will i boot this ext2ramdisk in my device? Just loading it to the ram, will that work? –  Sen Dec 8 '10 at 7:13
    
@Sen: The bootloader is responsible for loading both the kernel and the init(rd|ramfs) into RAM; see your bootloader's documentation. But even if you're building it by hand (why??) you should use find /bin /sbin /etc /dev ... | cpio -o | gzip -c > initramfs instead of initrd. –  ephemient Dec 8 '10 at 16:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.