Linux Newbie help
 help / color / mirror / Atom feed
* Block Device Size
@ 2002-06-03  1:08 Natarajan
  2002-06-04 20:41 ` Steven Smith
  0 siblings, 1 reply; 2+ messages in thread
From: Natarajan @ 2002-06-03  1:08 UTC (permalink / raw)
  To: Linux Newbie

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


-- 
Natarajan


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Block Device Size
  2002-06-03  1:08 Block Device Size Natarajan
@ 2002-06-04 20:41 ` Steven Smith
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Smith @ 2002-06-04 20:41 UTC (permalink / raw)
  To: Linux Newbie

[-- Attachment #1: Type: text/plain, Size: 1858 bytes --]

> 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.

> 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. :)

> /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,
sos22@cam.ac.uk.

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-06-04 20:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-03  1:08 Block Device Size Natarajan
2002-06-04 20:41 ` Steven Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox