Open BillDietrich opened 4 years ago
For each device, the partition size is given, but not the partition starting address. Please give starting address. Also please give any "flags" on the partition.
On Linux, this information can be obtained from "fdisk -l":
Disk /dev/sda: 298.1 GiB, 320072933376 bytes, 625142448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x505e25fb
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2000895 1998848 976M 83 Linux
/dev/sda2 2002942 625141759 623138818 297.1G 5 Extended
/dev/sda5 2002944 72312831 70309888 33.5G 83 Linux
/dev/sda6 72314880 625141759 552826880 263.6G 83 Linux
It would be great to have at least the information from lsblk correctly.
The method blockDevices() returns more or less information about the filesystem and not about the partition layout.
It would be great to have columns like PARTUUID and PARTLABEL, because this information is essential to identify and mount the filesystem to the correct mountpoint.
Mixing filesystems, disks and partitions to one data structure seems not to be the best idea, because they have almost nothing in common (just the name attribute and size).
I use as workaround now https://github.com/balena-io-modules/partitioninfo That thing is not calling any external command and reads the MBR directly - bleeding fast.
If your script has root access running "sfdisk -J /dev/xx" also returns everything you can imagine directly as JSON...
All of this is on Linux Mint 19.2, don't know if it shows up differently on other OS's:
For each device, the partition size is given, but not the partition starting address. Please give starting address. Also please give any "flags" on the partition.
For each device, there is a type field and an fstype field. But I think maybe these should be three fields, maybe devicetype (disk or part), partitiontype (primary, extended, logical) and fstype. The issue I am having is with understanding the partitioning on my Linux hard disk, as follows:
"sudo parted -l | more" gives me:
blockDevices gives me:
It seems to me that blockDevices is losing the distinction among physical/primary/extended/logical partitions. I don't fully understand this stuff, maybe I'm wrong about some of it. Thanks.