Bluehost.com Web Hosting $6.95

using dd to use available space

This is a discussion on using dd to use available space within the Linux General forums, part of the Linux Forums category; I would like to use 'dd' to write a file to a filesystem, leaving the least amount of free space ...


Go Back   Usenet Forums > Linux Forums > Linux General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-24-2008
adam.j.henry@gmail.com
 
Posts: n/a
Default using dd to use available space

I would like to use 'dd' to write a file to a filesystem, leaving the
least amount of free space available (preferably filling it up
completely). I'm having difficulty calculating the correct 'count='
parameter to use based upon the output of 'df'. I feel that I'm
missing something obvious, and hope that someone on this list can
point me in the right direction.

The following is the output of what I am running. The error reports
that I am attempting to write beyond the available space, and the data
is being truncated. Despite the error, 'ls -s' reports that the size
of the created file is different than the output record count!


cusa:~# df /dvd-stage
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg-dvd--stage
4515496 8952 4506544 1% /dvd-stage
cusa:~# dd if=/dev/zero of=/dvd-stage/test bs=1k count=4506544
dd: writing `/dvd-stage/test': No space left on device
4502133+0 records in
4502132+0 records out
4610183168 bytes (4.6 GB) copied, 161.554 seconds, 28.5 MB/s
cusa:~# ls -s --block-size=1k /dvd-stage/
total 4506560
16 lost+found 4506544 test


I have played with the 'bs=' value, setting it to the same as the
block size of the filesystem (4k), but received the same result. It
seems that some of the available space is being used for "header"
information as more data is written to the file, but can't put my
finger on it.

Would anyone please drop me a hint to help predict the maximum
'count=' to fill the filesystem?

Thanks a lot for any help,
Adam
Reply With Quote
  #2 (permalink)  
Old 03-24-2008
Hactar
 
Posts: n/a
Default Re: using dd to use available space

In article <228edacf-e04a-4add-bf37-acec848d02c2@f63g2000hsf.googlegroups.com>,
<adam.j.henry@gmail.com> wrote:
> I would like to use 'dd' to write a file to a filesystem, leaving the
> least amount of free space available (preferably filling it up
> completely). I'm having difficulty calculating the correct 'count='
> parameter to use based upon the output of 'df'. I feel that I'm
> missing something obvious, and hope that someone on this list can
> point me in the right direction.


When they went over inodes, they went roughly like this:
[----------------] \
[----------------] |
... | n direct slots
[----------------] |
[----------------] /
[----------------] indirect pointer
[----------------] doubly indirect pointer
[----------------] triply indirect pointer
disk block addresses --^

(I forget how big n is, but probably (n+3) * address_size = 1 disk_block.
If disk_block = 1 K and address_size = 8 B, n = 125, which seems way high.)
The indirect pointer points to a similar structure full of disk block
pointers. The doubly indirect pointer points to a block full of
indirect pointers, and the triply indirect pointer points to a block
full of doubly indirect pointers.

So a file can get crazy big before the structure fills up, and the disk
space taken up is decidedly non-linear WRT filesize.

But, you don't have to tell dd how many blocks to write, you can tell it
"write until the disk fills up", which is probably easier for you.

--
-eben QebWenE01R@vTerYizUonI.nOetP http://royalty.mine.nu:81
Are you confident that you appear to be professional in your electronic
communication? Consider this: A: No
Q: Can I top post? from nick@xx.co.uk
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:02 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0