Expanding a file size only descriptively

We need to create a series of files with over 1gb size for a project we  have.  We use fsutil and it works; the problem is that it affect the "free space" when querying the disk size.  Is there a waye to do this?
rayluvsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
No, I don't believe there is any way to "define" a file in the Windows file system without allocating the associate size of space.  Certainly not without hacking the NTFS file system catalog, and I wouldn't recommend that, too easy for bad side effects to occur.

Depending on what your need is - I'm assuming you aren't going to write to these fake files - you might be able to allocate one real file and then use symbolic links for the other files to reference the same space as the first file.


»bp
2
rayluvsAuthor Commented:
Understood.  So what is the next best thing in order to create a file without actually creating it's content?
0
Bill PrewIT / Software Engineering ConsultantCommented:
I had created a small C language utility back when dinosaurs roamed the earth, but the original EXE doesn't work on Windows 64-bit.  It was lightening fast at allocating a large file on disk (and reserving the space) without writing real data to the file.  If you have a C compiler you can compile it.  Or if you want I'm happy to compile it here and get you  the EXE, but I didn't want to lead with that as people can be leery of EXE's from unknown sources, as they should be.

It might be possible to duplicate the approach here in Powershell using .Net System.IO.FileStream but I haven't played around with that.

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
 
main(int argc, char *argv[])
{
  FILE *fp;
  long i;
  
  i = atol (argv[2]);
  i--;
 
  if (argc < 3)
  {
    printf("USAGE:  ALLOCATE filename size");
    exit(1);
  }
 
  if ((fp = fopen (argv[1], "wb")) == NULL)
    {
    perror ("Error opening output file!");
    exit (1);
    }

  if (fseek (fp, i, SEEK_SET))
    {
    perror ("Error positioning output file!");
    exit (1);
    }

  if (fputc (NULL, fp) == EOF)
    {
    perror ("Error writing to output file!");
    exit (1);
    }

  if (fclose (fp) == EOF)
    {
    perror ("Error closing output file!");
    exit (1);
    }

  exit (0);
}

Open in new window


»bp
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

rayluvsAuthor Commented:
Hi!

Thank you very much!

Did find a solution: FUTILS

Super fast no matter the size, but it stills allocate.

FYI:
      Format:
      fsutil    file    createnew    FileName    FIleSizeWanted


Thank you for your support!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bill PrewIT / Software Engineering ConsultantCommented:
Ah yes, good point, I had found that a while ago when needing something like this, and forgotten.


»bp
0
rayluvsAuthor Commented:
Thank you very much for your assistance.

We chose our entry since it solved the problem.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.