Solved

Create a dummy big file on Unix

Posted on 2004-04-29
5
1,988 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ubuntu 16.04 Emergency Boot 2 233
DNS Dynamic Update 7 71
wireless name in LAN adapter 14 80
red x mark on an audio icon 10 42
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…
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
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.

749 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