Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If <code>rm -rf</code> is slow, perhaps you are using a "sync" option or similar, which is writing to the disk too often. On Linux ext3 with normal options, <code>rm -rf</code> is very quick.</p> <p>One option for fast removal which would work on Linux and presumably also on various Unixen is to use a loop device, something like:</p> <pre><code>hole temp.img $[5*1024*1024*1024] # create a 5Gb "hole" file mkfs.ext3 temp.img mkdir -p mnt-temp sudo mount temp.img mnt-temp -o loop </code></pre> <p>The "hole" program is one I wrote myself to create a large empty file using a "hole" rather than allocated blocks on the disk, which is much faster and doesn't use any disk space until you really need it. <a href="http://sam.nipl.net/coding/c-examples/hole.c" rel="nofollow noreferrer">http://sam.nipl.net/coding/c-examples/hole.c</a></p> <p>I just noticed that GNU coreutils contains a similar program "truncate", so if you have that you can use this to create the image:</p> <pre><code>truncate --size=$[5*1024*1024*1024] temp.img </code></pre> <p>Now you can use the mounted image under mnt-temp for temporary storage, for your build. When you are done with it, do this to remove it:</p> <pre><code>sudo umount mnt-temp rm test.img rmdir mnt-temp </code></pre> <p>I think you will find that removing a single large file is much quicker than removing lots of little files!</p> <p>If you don't care to compile my "hole.c" program, you can use dd, but this is much slower:</p> <pre><code>dd if=/dev/zero of=temp.img bs=1024 count=$[5*1024*1024] # create a 5Gb allocated file </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload