Saturday, April 20, 2024
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 1198  / 1 Year ago, wed, february 22, 2023, 1:59:45

I'm using gparted on a dual-boot system, and a partition that I think is used by Windows shows up with the "diag" flag, in spite of it being listed as an ext4 format. Not readable, however, so the partition signature may be corrupt. So I'm just confused.


I'd like to know what the flag means to gparted, and where it is in the MBR or perhaps the partition signature, and how I could see that same flag in the output of lsblk or some other command-line utility (I want to recognize it in a bash script). Right now it's just an enigma.


More From » partitioning

 Answers
3

Thanks to @PonJar. I'm collecting our conversation into another answer.


"diag" is reported by gparted. The same flag is reported as "msftres" by parted, and the partitions are reported as "Microsoft Recovery Partition" in Windows 10's Disk Management. It may be that the flag has other uses, but for my purposes, this means that the partition is for the benefit of Windows. It appears that Microsoft does not bother with a filesystem signature for these partitions, so I can't make any inferences about the presence of data or its format.


For scripting, I've decided to use "parted /dev/<drive name> print" and filter the line(s) of interest. For example, for partition 3, I might use


if parted /dev/sda print | 
sed -e "1,/Number/"d" |
grep -e "^ *3 " |
fgrep msftres >/dev/null
then
DIAG=1
else
DIAG=0
fi

[#2614] Thursday, February 23, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
measord

Total Points: 259
Total Questions: 131
Total Answers: 106

Location: Venezuela
Member since Sun, Oct 2, 2022
2 Years ago
;