Results 1 to 4 of 4
  1. #1

    How to create an large empty file on unix? (like with touch -size 4GB)

    Hi,
    I need to take up space (4gigs) on purpose for testing purposes and would like to create a large (empty) file. I would like to know if there is a simple command that exists to do this (like "touch")?

    I don't want to have to resort to copying a large file over the network, tarring a large dir, catting files, or any type of script to create a large file.

    Any ideas?

    Puzzled
    Last edited by runningaround; 12-17-2004 at 02:16 PM.

  2. #2
    Join Date
    Nov 2001
    Location
    Ann Arbor, MI
    Posts
    2,978
    man dd

    or

    dd if=/dev/zero of=/path/to/file count=123456
    -Mark Adams
    www.bitserve.com - Secure Michigan web hosting for your business.
    Only host still offering a full money back uptime guarantee and prorated refunds.
    Offering advanced server management and security incident response!

  3. #3

    dd works. Thanks

    Thank you! That does work! apparently prealloc filename 2100000 also works but I don't have prealloc. Thanks again!

  4. #4
    Join Date
    Nov 2001
    Location
    Ann Arbor, MI
    Posts
    2,978
    Great! Glad it worked for you.
    -Mark Adams
    www.bitserve.com - Secure Michigan web hosting for your business.
    Only host still offering a full money back uptime guarantee and prorated refunds.
    Offering advanced server management and security incident response!

  5. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •