How to find the number of unsed sectors?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hello to all,

Can any one please tell me how to find the no of used sectors from the
hdd. Is there any linux command to find out that??


Re: How to find the number of unsed sectors?
Quoted text here. Click to load it

Sectors on a HD are not marked "used" in any way.

On a HD there can be lots of partitions.
The partition table indicates what sectors are assigned to what
partitions. There might be sectors that are not assigned to any
partition. Same can be called "unused".

In each partition there can be a file system. Linux provides drivers for
a lot of different file systems as a standard and everybody can create a
new one if he likes.

Each kind of file system has it's own method to define which sectors are
assigned to what kind of information (e.g. to the file allocation table,
to the main directory, to a subdirectory, to a file, or to the chain of
unused blocks. That was said with an FAT file system in mind, other file
systems can be much more complicated.

So the short answer is: you can't.

-Michael

Re: How to find the number of unsed sectors?
Quoted text here. Click to load it

How about getting the book on kernel internals instead
of milking unconnected information fragments here in the
newsgroup?

What you want to do is very prone to crash the whole system
unless the programmer understands what's going on inside
the kernel.

--

Tauno Voipio
tauno voipio (at) iki fi

Re: How to find the number of unsed sectors?

Quoted text here. Click to load it

This depends on the partition structure and the filesystems
on each partition.

For a mounted filesystem you could use df to get a
snapshot of the usage. It does not necessarily map
to actual sectors on the disk.

~$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/hda3             79013284  47764916  31248368  61% /

In this example, there are 47764916 used blocks in this
specific partition. One block is two sectors on this disk.

Kind regards,

Iwo


Site Timeline