Solved

Create a dummy big file on Unix

Posted on 2004-04-29
5
1,985 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Clickfree HD 6 105
IBMi supported MySQL versions. 2 48
HP BIOS Application Error (501) shows up at booting 67 93
Windows 8 - Second Application Launching 2 42
As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
Sometimes a user will call me frantically, explaining that something has gone wrong and they have tried everything (read - they have messed it up more and now need someone to clean up) and it still does no good, can I help them?!  Usually the standa…
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.

773 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