[lug] q: ramdisk /tmp & mount plain files

Chan Kar Heng chankarheng at gmail.com
Mon May 3 02:09:29 MDT 2010

thanks David! (Stearns, Morris, & Ahern)

1) yea, you're right on that. i did a bit more google using the keywords 
you & others have sent over & found a few more remarks.
tmpfs & ramfs all look like good options. i'd think, for personal use, 
tmpfs will fit just nice.

so far, it's something that's really based on context of usage, & there 
isn't a 1 solution fits all thing.

2) i think cat /dev/sda0 works. at one point in time, i think i created 
a redhat 9 image for use with colinux using that very command. if not, i 
had likely used dd after that. :)

oh a bit more googling led me to something called mdconfig & 
"file-backed" devices too.

many thanks again!
best regards,


David Stearns wrote:
> On Sun, 2010-05-02 at 11:22 -0600, David Stearns wrote:
>> On Mon, 2010-05-03 at 00:44 +0800, Chan Kar Heng wrote:
>>> hi,
>>> 1) wanted to ask some opinion on creating a ramdisk & using it as /tmp.
>>> that way, /tmp always starts off empty on a fresh boot.
>>> it's always fast to access /tmp too.
>>> since /tmp isn't meant to really keep things, it could be kept small?
>>> these days, most machines have tons of memory to spare anyway.
>>> isn't it a good idea?
>>> why isn't it common place?
>> Hmm, only potential issue I see is if you ever have large files being
>> created in /tmp.  I've seen a couple 10+ gig files in tmp before, I'm
>> not sure how that would be handled.
>>> 2) how could i mount a plain binary file as a read/write filesystem?
>>> that's assuming that one can do an mkfs on a plain file too.
>>> context is that, i might backup an entire filesystem to a plain file 
>>> (eg: cat /dev/sda0 > /home/myhome/myfsbackup;
>>> so now I wanna do a mount /home/myhome/myfsbackup /mymountpoint and be 
>>> able to access things backed up.)
> Whoops, teach me to not read the whole paragraph in detail... The
> typical way I've seen to backup a filesystem to a file (no compression,
> and this will "backup" any free space) is 
> `dd if=/dev/sda0 of=/home/myhome/myfsback`.
> Also, you can use mkfs on a file, but typically you would only do that
> to create an empty filesystem on a file that you could mount and the
> copy what you wanted to backup to the mount point.  When you dd the
> partition, it includes all the existing file system info.  This way you
> don't need to mkfs.  Correct me if I misunderstood the comment on
> mkfs...
>> You should be able to 
>> `mount -oloop -t<fstype> /home/myhome/myfsbackup /mymountpoint`
>> That should do what you need.
>> Regards
>> -David Stearns
> -David.
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety

More information about the LUG mailing list