Re: Partition information as text file?
- Date: Mon, 28 Jan 2019 06:48:00 -0600
- From: Richard Owlett <rowlett@xxxxxxxxxxx>
- Subject: Re: Partition information as text file?
On 01/27/2019 03:26 PM, David Wright wrote:
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.
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 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.
That's likely. There are some terminology issues I'll have to follow up
on so that I'll use terms in ways compatible to others.
So it looks as if df --output -x tmpfs -x devtmpfs gives you all
you want (and more) with the exception of LABELs.
No. The man pages states it only looks at mounted partitions due to
"...nonportable intimate knowledge of file system structures]. As I only
have FAT and ext partitions, what I want should be doable if not already
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.
I'm going to have to reread this thread. There is something in the back
of mind hinting at a solution. It will require some scripting to pull
pieces together, but that was assumed to be likely anyway.