Re: Partition information as text file?
- Date: Mon, 28 Jan 2019 16:24:24 +0100
- From: Ionel Mugurel Ciobîcă <I.M.Ciobica@xxxxxxxxx>
- Subject: Re: Partition information as text file?
On 28-01-2019, at 06h 48'00", Richard Owlett wrote about "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.
You know, gparted is based on parted, that is text based. Also use
fdisk, skdisk, etc. that are text based. You redirect their output
into a text file that you can use in your spread sheet program
(whatever that can be). For example fdisk -l (as root) will output all
partitions on all disks from a system. You can grep it, pipe it to sed
to modify stuff, awk to play with columns, etc. to make it look like
you please. If you can ssh to those machine, you can do it like this:
for m in machine1 machine2 machine3 ; do
ssh $m fdisk -l
done > file_with_all_partition_info_machines_1-3.txt
If you plan to use that info to recreate partitions, use the dump
version of sfdisk: sfdisk -d /dev/sda > sfdisk_dump_sda.txt
that you can use to make those partitions to another drive:
sfdisk /dev/sdX < sfdisk_dump_sda.txt
If you want a graphical ouput, something along the lines of gparted,
just grab the screen with import. I usually do this:
sleep 3 ; import file.jpg
on a terminal to make sure I have time to put the main window on focus