-
-
Save taoky/f739fad4e7ef2d445b946b379cf2fa6b to your computer and use it in GitHub Desktop.
/proc/mdstat logic (Linux 6.7)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# md_seq_show | |
- printf("%s: %sactive", dev, active ? "" : "in") | |
- if active | |
- if rdonly then printf(" (read-only)") | |
- if autoread then printf(" (auto-read-only)") | |
- printf(" %s", raidtype) | |
- for each dev | |
- printf(" %pg[%d]", dev, nr) | |
- * NOTE: %pg is a special format that prints the device name | |
- if writemostly then printf("(W)") | |
- if journal then printf("(J)") | |
- if faulty then printf("(F)") | |
- if spare then printf("(S)") | |
- if replacement then printf("(R)") | |
- if has disks then printf("\n %llu blocks", sectors/2) | |
- if persistent then printf(" super %d.%d", major, minor) | |
elif external then printf(" super external:%s") | |
else printf(" super non-persistent") | |
- if active | |
- personality status() | |
- printf("\n ") | |
(don't care about the rest output) | |
- else printf("\n ") | |
(don't care about the rest output) | |
# Personality status | |
## RAID0 | |
printf(" %dk chunks") | |
## RAID1 | |
- printf(" [%d/%d] [", disks, disks - degraded) | |
- for each dev' | |
- The order of dev' might be different from "dev" above. | |
- printf("%s", is_sync ? "U" : "_") | |
- printf("]") | |
## RAID10 | |
- if near_copies < geo.raid_disks then printf(" %dK chunks") | |
- if near_copies > 1 then printf(" %d near-copies") | |
- if far_copies > 1 then | |
- if far_offset then printf(" %d offset-copies") | |
- else printf(" %d far-copies") | |
- if far_set_size != raid_disks then printf(" %d devices per set") | |
- printf(" [%d/%d] [") | |
- for each dev' | |
- printf("%s", is_sync ? "U" : "_") | |
- printf("]") | |
## RAID5 | |
- printf(" level %d, %dk chunk, algorithm %d") | |
- printf(" [%d/%d] [") | |
- for each dev' | |
- printf("%s", is_sync ? "U" : "_") | |
- printf("]") | |
## Linear | |
printf(" %dk rounding") | |
## Multipath | |
- printf(" [%d/%d] [") | |
- for each dev' | |
- printf("%s", is_sync ? "U" : "_") | |
- printf("]") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment