Skip to contentSkip to conversation

Block Device Size

DISCUSSION Natarajan 2 participants 2 messages Jun 3, 2002 – Jun 4, 2002

lore
Share & tools
lore

Natarajan

author
#0 lore raw

Hi,
I created a block device on an ext2 partition. I ran mkreiserfs on that
device. What is the size of this device that I have created? Once I mount the device and use df, the size of the device is greater than that of the ext2 partition in which I created the device.

Here is the ouput of df

/dev/hda9 3.4G 2.0G 1.4G 58% /
none 62M 0 61M 0% /dev/shm

/dev/hda1             3.7G  	2.4G  1.3G   63% /mnt/win_c
/dev/hda5             3.4G  	2.5G  992M  72% /mnt/win_d
/dev/hda6             2.9G  	2.2G  826M  73% /mnt/win_e
/dev/hda7             2.9G  	2.1G  862M  72% /mnt/win_f
/dev/hda10            2.2G  	818M  1.2G  39% /natarajan
/natarajan/reiser.fs  3.7G  	 33M  3.6G   1% /natarajan/mount
Signature · 8 lines
Natarajan


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
#1 lore raw
Quoted 2 lines

I created a block device on an ext2 partition. I ran mkreiserfs on that device. What is the size of this device that I have created?

That depends on how you created it. If you used mknod and created a block special, the data for the device will be stored on a physical partition, and the size of the device will be equal to that of the partition.

If you created an ordinary file using e.g. dd, and attached the loopback block device to it, then the device's size is equal to that of the underlying file.

Quoted 3 lines

Once I mount the
device and use df, the size of the device is greater than that of the ext2 partition in which I created the device.

This could happen trivially if the device is a block special and the target partition is larger than the containing partition.

It can also happen using loopback devices if the partition file is sparse. This means that large chunks of the file which are full of zeros do not need to be stored. A file created using
``dd if=/dev/zero of=some_file count=1 seek=100'' will be sparse, for instance. To check whether a given file is sparse, compare the sizes given for it by ls and du - du gives the amount of disk allocated, whereas ls gives the number of bytes which can be read from the file, so du sizes are smaller than ls sizes for sparse files.

Some old documents recommend the use of sparse files for filesystem images, in order to save space. However, this is an extremely bad idea on recent kernels, and can cause a deadlock, which will bring the system to its knees in a few minutes. I tested this before sending this message, and it's still a problem on 2.4.18. :)

Quoted 1 line

/natarajan/reiser.fs 3.7G 33M 3.6G 1% /natarajan/mount

I'd guess from this that you're using a sparse filesystem image file. You might want to reconsider.

Steven Smith,
[email protected].