Web lists-archives.com

Re: Partition information as text file?




On Sat 26 Jan 2019 at 15:10:55 (-0600), Richard Owlett wrote:
> On 01/26/2019 01:32 PM, Felix Miata wrote:
> > Richard Owlett composed on 2019-01-26 08:32 (UTC-0600):
> > 
> > > I am attempting to create a spreadsheet to document the content of
> > > multiple disks of multiple machines.
> > 
> > > Gparted displays the desired information.
> > > *HOWEVER* I see no way to capture the information.
> > 
> > > At the command line using "lsblk -o NAME,FSTYPE,LABEL /dev/sdb" gives
> > > most of the desired information.
> > 
> > > It omits partition size, used space, and unused space.
> > 
> > > Suggestions?
[…]
> > Sometimes I append output from lsblk or parted -l.
> > 
> > hdparm and smartctl might also provide some of what you're looking for.
> 
> I'll attempt to redefine my problem.
> 
> I have:
>   multiple machines
> each having
>   multiple disks
> each having
>   multiple partitions.
> 
> I wish to inventory the above "conglomeration".
> 
> I wish to to answer the question(s):
>   How big is each
>   How much is available

It appears that you're really interested in the filesystems'
information rather than the partitions', with the exception of the
filesystem LABELs, which you have said elsewhere you use as
indications of the filesystems' contents.

So it looks as if   df --output -x tmpfs -x devtmpfs   gives you all
you want (and more) with the exception of LABELs. It seems sensible
to use   lsblk -o NAME,LABEL -l   to get these because AFAICT it
automatically handles the business of selecting e2label/dosfslabel/etc
as appropriate and gets them all in a heap.

With judicious use of head, tail and sort, it would be fairly simple
to get the two listings to correspond well enough for entry into a
spreadsheet (I don't know what you meant by 'generic'), making
final adjustments (df omits the device and partitions like swap) to
line things up.

> OWL now DUCKS fer cover ;/

No need.

Cheers,
David.