Web lists-archives.com

Re: Partition information as text file?




Hi,

Richard Owlett wrote:
> Though I not a C programmer, their organization leads to answers for my
> questions [even a few I hadn't asked].

It's C++ in this case. (bleh ...)

But what i meant is that Gparted runs external programs, which a simple
shell script could do too.

https://github.com/GNOME/gparted/blob/master/src/ext2.cc#L147
uses
  dumpe2fs -h ...partition.path...
and if the partition is not mounted 
  resize2fs -P ...partition.path...

https://github.com/GNOME/gparted/blob/master/src/fat16.cc#L129
uses
  fsck.fat -n -v ...partition.path...
or if that is not present
  dosfsck -n -v ...partition.path...

The Gparted C++ code then looks for particular text snippets in the
output of the programs in order to read the numbers which follow.

One may suck more hints from the programmers' comments in the lines
which begin by "//".


Have a nice day :)

Thomas