Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Create a dummy big file on Unix

Posted on 2004-04-29
5
Medium Priority
?
1,995 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 120 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 80 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Just about everyone has an old PC laying around.  Ask anyone in the IT industry, whether they are a professional or play in it as a hobby.  From outdated Desktops to cheap "throwaway" laptops, they are all around and not as hard to "fix up" as you m…
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…
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.

721 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