ramdisks [a solution]

Mike Wright mike.wright at mailinator.com
Fri Apr 17 21:13:37 UTC 2009


Bill Davidsen wrote:
> Mike Wright wrote:
>> Bill Davidsen wrote:
>>> Mike Wright wrote:
>>>> I came up with a solution that uses LVM and it works a *charm*, 
>>>> albeit, probably because of large block sizes relative to the 16M 
>>>> size of the ramdisks, seems inefficient (costs 25% each).  Maybe I 
>>>> can tune these and get better.
>>>>
>>>> pvcreate /dev/ram15
>>>> pvcreate /dev/ram14
>>>> pvcreate /dev/ram13
>>>> pvcreate /dev/ram12
>>>>
>>>> vgcreate my36Mdisk /dev/ram15 /dev/ram14 /dev/ram13
>>>> vgcreate my12Mdisk /dev/ram/12
>>>>
>>>> lvcreate -n myRamDisk1 -L 36M my36Mdisk
>>>> lvcreate -n myRamDisk2 -L 12M my12Mdisk
>>>>
>>> Wow that sounds complex, why not just make the ramdisks larger? Just 
>>> use the boot parameter which sets that:
>>>   ramdisk_size=N
>>> where N is the size in kilobytes, so for 256M you specify 262144.
>>>
>>
>> Thanks for that advice.
>>
>> I ended up making the ramdisks smaller which gave me greater 
>> granularity.  Then when the volume groups were created I specified 64K 
>> extents instead of the default 16M.  That gave two benefits: there was 
>> almost no wasted space in the VG, and the data that I copied over used 
>> less than half of the space of the original.
>>
> In thinking about this related to another issue, I remember that you can 
> also just create a single arbitrary ramdisk and mount it:
>   mount -t tmpfs -o size=270m tmpfs /mnt/tmp
> which gives you a 270MB ramdisk on /mnt/tmp. No choice of filesystem 
> type, always tmpfs, but for what I wanted adequate.
> 
> I'm doing some testing on performance tips, and am using this for testing.
> 

That accomplishes everything I wanted when combined with "mount --move" 
and lets me get rid of a horrendous script :D

create temporary work area.
copy work area to temporary work area.
mount --move to original work area.

   Work work work until done

mount --move original work area back to temporary area.
copy temporary work area to original work area.
unmount temporary work area.

If it hits swap I can live with that.


Awesome, Bill!




More information about the fedora-list mailing list