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

David Stearns stearns at dhyw.com
Sun May 2 11:28:51 MDT 2010


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.




More information about the LUG mailing list