Free/Used space on unmounted storage devices

Madison Kelly linux at alteeve.com
Fri Feb 29 06:13:49 PST 2008


Andy Shevchenko wrote:
> Hi Madison Kelly!
> 
>  On Thu, Feb 28, 2008 at 02:13:11PM -0500, Madison Kelly wrote next:
> 
>>    Is there any way (in or out of HAL) under Linux/*nix to determine the 
>> number of user and free blocks/bytes on a storage device/partition that 
>> *isn't* mounted?
> IIRC, you should see the volume namespace even it's not mounted.
> 

Thank you kindly for your reply.

I've been using the output from 'hal-device' to parse for hardware data, 
perhaps I should use something else? I had hoped to use 'Net::DBus' for 
perl, but it's poorly documented and I have so far failed to get it 
working. :)

Here is a sample output from 'hal-device' for an unmounted partition. I 
can see various size-type data like block size, number of blocks, total 
size and such, but no information on used/free space. Perhaps I am 
missing something?

Madison

-=] Output for an unmounted flash drive [=-

0: udi = '/org/freedesktop/Hal/devices/volume_uuid_E433_C5B9'
   block.minor = 17  (0x11)  (int)
   volume.label = 'NEW VOLUME'  (string)
   volume.ignore = false  (bool)
   org.freedesktop.Hal.Device.Volume.method_names = { 'Mount', 
'Unmount', 'Eject' } (string list)
   info.capabilities = { 'volume', 'block' } (string list)
   volume.partition.flags = {  } (string list)
   volume.is_partition = true  (bool)
   volume.mount_point = ''  (string)
   info.category = 'volume'  (string)
   info.product = 'NEW VOLUME'  (string)
   volume.is_disc = false  (bool)
   volume.is_mounted = false  (bool)
   volume.partition.type = '0x06'  (string)
   block.is_volume = true  (bool)
   volume.linux.is_device_mapper = false  (bool)
   block.storage_device = 
'/org/freedesktop/Hal/devices/storage_serial__Patriot_Memory_077B14B40091_0_0' 
  (string)
   info.parent = 
'/org/freedesktop/Hal/devices/storage_serial__Patriot_Memory_077B14B40091_0_0' 
  (string)
   volume.block_size = 512  (0x200)  (int)
   volume.partition.number = 1  (0x1)  (int)
   volume.num_blocks = 2008062  (0x1ea3fe)  (int)
   volume.fsversion = 'FAT16'  (string)
   block.device = '/dev/sdb1'  (string)
   volume.uuid = 'E433-C5B9'  (string)
   volume.partition.label = ''  (string)
   volume.partition.scheme = 'mbr'  (string)
   volume.partition.media_size = 1031798784  (0x3d800000)  (uint64)
   volume.partition.uuid = ''  (string)
   volume.fsusage = 'filesystem'  (string)
   volume.is_mounted_read_only = false  (bool)
   org.freedesktop.Hal.Device.Volume.method_argnames = { 'mount_point 
fstype extra_options', 'extra_options', 'extra_options' } (string list)
   info.interfaces = { 'org.freedesktop.Hal.Device.Volume' } (string list)
   storage.model = ''  (string)
   volume.size = 1028127744  (0x3d47fc00)  (uint64)
   info.udi = '/org/freedesktop/Hal/devices/volume_uuid_E433_C5B9'  (string)
   volume.mount.valid_options = { 'ro', 'sync', 'dirsync', 'noatime', 
'nodiratime', 'noexec', 'quiet', 'remount', 'exec', 'utf8', 
'shortname=', 'codepage=', 'iocharset=', 'umask=', 'dmask=', 'fmask=', 
'uid=', 'flush', 'usefree' } (string list)
   org.freedesktop.Hal.Device.Volume.method_signatures = { 'ssas', 'as', 
'as' } (string list)
   block.major = 8  (0x8)  (int)
   volume.fstype = 'vfat'  (string)
   org.freedesktop.Hal.Device.Volume.method_execpaths = { 
'hal-storage-mount', 'hal-storage-unmount', 'hal-storage-eject' } 
(string list)
   volume.unmount.valid_options = { 'lazy' } (string list)
   linux.hotplug_type = 3  (0x3)  (int)
   volume.partition.start = 32256  (0x7e00)  (uint64)
   linux.sysfs_path = '/sys/block/sdb/sdb1'  (string)


More information about the hal mailing list