[Ilugc] doubt in dd

  • From: vijairaj.r@xxxxxxxxx (Vijairaj)
  • Date: Thu Oct 12 00:03:05 2006

On 10/11/06, Girish Venkatachalam <girishvenkatachalam@xxxxxxxxx> wrote:

Another thing I do is create memory filesystems known in linux as loopback 
device files.

/dev/zero is a special file like /dev/null which gives an inexhaustible 
string of zeroes.

So you can create a file of arbitrary size quickly with

#dd if=/dev/zero of=1mfile count=1024 bs=1024\*1024

An interesting feature that I find very useful is the option 'seek',
the command above can instead be used as:
dd if=/dev/zero of=1gfile bs=1024 seek=1024k count=1

This will create a 1 gb file but the actual blocks are not allocated
(you can verify it using stat/du). As the filesystem on this file gets
populated, the necessary space will be allocated.

--
Vijairaj
http://vijairaj.r.googlepages.com/

Other related posts: