Solved

Create a dummy big file on Unix

Posted on 2004-04-29
5
1,983 Views
Last Modified: 2011-01-18
Is there anyway to create a dummy large file on Unix in order to take up some disk space?
0
Comment
Question by:SCMB-GMIT
  • 3
5 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10948810
Hi SCMB-GMIT,

find <some_dir> -type f | xargs cat  > big_file

will create a file which is all the files under (some_dir) put together

Sunnycoder
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10948813
btw what are you trying to do ?
0
 

Author Comment

by:SCMB-GMIT
ID: 10948882
Thanks; but it is not 100% what I'm looking for.

Just trying to reserve some disk space for future use. Some developers tend to think they own all the disk space on the box.
I'm thinking in reserving about 3Gb - so ideally I need to create a 3Gb file.
0
 
LVL 17

Accepted Solution

by:
owensleftfoot earned 30 total points
ID: 10948892
dd if=file of=file bs=n count=n

The dd command has many uses. Not only will it convert files but it will also copy files. So where do you find a file over 100MB to copy or convert with dd?

Zero. Zero? Yes, there is a wonderful device called /dev/zero. This device reads from a special file that always returns a buffer full of zeros. The best thing about it is that you can use an endless amount:

% dd if=/dev/zero of=100megs bs=10000 count=10000
100+0 records in
100+0 records out

% ls -al 100megs
-rw-r--r--     1 foo staff      100000000 Sep 26, 01:48 100megs

This dd command takes 10,000 blocks of buffered zeros and copies it 10,000 times into the file called 100megs. In no time you will have a file that is exactly 100MB. The numbers can be tweaked to create a file even larger or smaller, depending on your needs.
0
 
LVL 45

Assisted Solution

by:sunnycoder
sunnycoder earned 20 total points
ID: 10948896
In that case you should be using disk quotas ... or rather your sys admin should have implemented disk quotas
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
#Citrix #POC #XenDesktop #vCenter #VMware #ESX
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now