Wednesday, December 15, 2010

Raw file creation in linux

Raw Data files can be created pretty fast in Linux using
dd if=/dev/zero of=/tmp/file1g.tmp bs=1M count=1024
bs = block size
count = No. of blocks

To create sparse-file in linux using dd command
dd if=/dev/zero of=sparse-file bs=1k count=0 seek=5120
Will create a file of five megabytes in size, but with no data stored on disk (only metadata)
dd if=/dev/zero of=sparse-file bs=1k count=0 seek=10000 > this will create the file size of 10 MB.
we can create the sparse file in local computer but while scp'ing it to different computer it will be extracted from metadata and will show full data size

Increasing the count section will increase the actual data size, 0 = means no actual data
you can change count to 1,2,3,4,etc

No comments:

Post a Comment