Solved

Create a dummy big file on Unix

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction How to create multiboot configuration with XP\Vista and Windows 7 on it? And most important question - how to do this correctly so not to have any kind of nightmares we get when system gets screwed? First of all one should realize t…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

18 Experts available now in Live!

Get 1:1 Help Now