Create file for space Reserve

Hi All,

I want to make a 3GB of space reserve on Solaris. Let me know whether there is a way by creating empty file of 3GB so that i can delete that file in future to utilize that space. Or any other better ways for space reserve.

-Vinodh' Kumar

the find command, du, and other command line tools can monitor space. I am not sure if filling up your HD with dummy files to take up space only to delete them later on is a good practice. Seems like a lot of work for something that can be accomplished in a better way.

What are your exact concerns?

Yes exactly want to create dummy file and delete in future for space. I need to know the command to create empty file with specified amount of size.

Or any other workout to manage space.

This is usually done by reigning in the size of a filesystem.
But you can create a sparse file:

dd if=/dev/zero of=sparsefile bs=1 count=1 seek=3G

This should take less than a second to create. But this is probably not what you want.
If you want to reserve space as contiguously as possible to be used later by a database, then you should not create a sparse file, but a dense file:

dd if=/dev/zero of=densefile bs=1M count=3072

This will take a lot longer to create, as it fills the entire file with zeroes.

Use caution with the dd command though. You should read the man page first to understand what it does and think twice before issuing a command as it is a very powerful command that can easily destroy things.
Not every dd understands G and M, but only k as a signifier. I that is the case then you should be able to use 1024k instead of 1M or 3145728k instead of 3G in the examples above.

If you create both files and you issue

ls -l *file

then you should see both files and they should have the same size.

du -k *file

will show the difference

S.

---------- Post updated at 09:22 ---------- Previous update was at 08:53 ----------

Since you are on Solaris. check out:

man mkfile
mkfile 

command solved my problem.

Thank you:)