Web lists-archives.com

Re: Partition information as text file?




On Sat 26 Jan 2019 at 08:32:28 (-0600), Richard Owlett wrote:
> 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?

Just remove the g[nome] from the command name.

# parted -l
Model: ATA ST500LX005-1CW16 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name                          Flags
 1      1049kB  1050MB  1049MB  ntfs            Basic data partition          hidden, diag
 2      1050MB  1322MB  273MB   fat32           EFI system partition          boot, hidden, esp
 3      1322MB  2371MB  1049MB  fat32           Basic data partition          hidden
 4      2371MB  2505MB  134MB                   Microsoft reserved partition  msftres
 5      2505MB  178GB   175GB   ntfs            Basic data partition          msftdata
 6      178GB   220GB   41.9GB  ext4            Linux-A
 7      220GB   262GB   41.9GB  ext4            Linux-B
 8      262GB   452GB   191GB                   Linux-Home
 9      452GB   452GB   8389kB                  Linux-BIOS-Boot               bios_grub
10      452GB   457GB   4502MB  linux-swap(v1)  Linux-Swap
11      457GB   457GB   367MB   ntfs                                          hidden, diag
12      457GB   458GB   1074MB  ntfs            Basic data partition          msftdata
13      458GB   485GB   26.8GB  ntfs            Basic data partition          msftdata
14      485GB   500GB   15.1GB  ntfs            Basic data partition          hidden, diag

If you want a lot more information than is there, one method is:

$ for j in /sys/class/block/* ; do udevadm info "$j" ; done | less

but it will need parsing before you can can dump any of it in a
spreadsheet. (And note that the output is not in sequence because
of globbing.)

Cheers,
David.