Hello everyone
I am new to this forum
I am working on a project and needed a test script to fill up a disk partition /tmp/data to see how the program fails.
The system I am working on is a redhat 5.3.
Is there anything out there?
Thanks.
Hello everyone
I am new to this forum
I am working on a project and needed a test script to fill up a disk partition /tmp/data to see how the program fails.
The system I am working on is a redhat 5.3.
Is there anything out there?
Thanks.
We've posted the answer to this one several times- please use our search.
I tried some search, nothing in particular came up.
If you have a pointer, let me know. Many thx
Be careful that /tmp/data is a mountpoint under /tmp. You don't want to fill /tmp itself on a running system because system commands can fail.
One simple way of creating a file which grows rapidly:
yes > filename
Yes I understand that if /tmp is full it could bring the system down to its knee but this is a control test environment so that shouldn't be an issue. I can always remove those files.
what i need is a script which will find out how much space is available on /tmp/data like df -h /tmp/data and then go ahead and fill it up with some file say filler to about 95% full or have less than 1.5GB available. thx
On a linux system, you can mount a small loopback file system under /tmp/data to simulate the shortage of space.
that sounds like an option to use. tell me more about loopback file system. thx
#create empty file of 1000Mb
dd if=/dev/zero of=/tmp/data bs=1024k count=1000
a test script to fill up a disk partition /tmp/data
Please post your actual requirement in the future. Please make it clear whether you are a root user (who can fill a disc).
dd if=/dev/zero of=100M.fs bs=1M count=100
mke2fs 100M.fs
mount -o loop 100M.fs /tmp/data #run with root id or sudo
Here's how to get /tmp 85% full; change the value if you like:
$ amt=$(df --total /tmp | awk '/^total/ { printf "%d\n", (($2 * 1024) * 0.85); exit}')
$ dd if=/dev/zero of=/tmp/filler bs=${amt} count=1