etcher
etcher copied to clipboard
MacOS blacklist only works with /dev/diskX, not /var/run/disk/by-serial/*, which links to correct disks.
- Etcher version: 1.18.11
- Operating system and architecture: MacOS Ventura
- Image flashed: NA
- What do you think should have happened: Blocklist should ignore drives..
- What happened: Drives show
- Do you see any meaningful error information in the DevTools? No
EDIT: Ok, so OpenZFS installed a daemon that creates a /var/run/disk folder that simulated the /dev/disk folder on Linux. So there is no wonder why the function doesn't work for Etcher. But, the code to make /dev/drive/by-id to work in Linux should also do the same think for my MacOS setup. I just wish that https://github.com/openzfsonosx/zfs/tree/master/cmd/InvariantDisks was part of macOS.
The blacklist of using /dev/disk1, etc works. But the disks change on reboot, or just mounting them at different times. a much better way is to use the /var/run/disk/by-id, /var/run/disk/by-path, or /var/run/disk/by-serial. This is just like on Linux with /dev/disk/by-id/, where they are symbolically linked to the actual device.
I did get blocking to work, so the JSON format is correct.
I haven't ran etcher on Linux, so I don't know whether or not /dev/disk/by-id works or not there... But the code should work the same.
This works
{
"errorReporting": false,
"updatesEnabled": true,
"desktopNotifications": true,
"autoBlockmapping": true,
"decompressFirst": true,
"driveBlacklist": [
"/dev/disk0",
"/dev/disk1",
"/dev/disk10",
"/dev/disk11",
"/dev/disk12",
"/dev/disk13",
"/dev/disk14",
"/dev/disk15",
"/dev/disk16",
"/dev/disk2",
"/dev/disk3",
"/dev/disk4",
"/dev/disk5",
"/dev/disk7",
"/dev/disk8",
"/dev/disk9"
]
}
This doesn't
{
"errorReporting": false,
"updatesEnabled": true,
"desktopNotifications": true,
"autoBlockmapping": true,
"decompressFirst": true,
"driveBlacklist": [
"/var/run/disk/by-serial/0ALE601-1SG0PXXX",
"/var/run/disk/by-serial/0ALE601-7JJ1NXXX",
"/var/run/disk/by-serial/0ALE601-7JK93XXX",
"/var/run/disk/by-serial/0ALE601-7JKE88VG",
"/var/run/disk/by-serial/APPLE_SSD_AP1024R-0ba018e3e2390XXX",
"/var/run/disk/by-serial/Extreme_SSD-19414J449XXX",
"/var/run/disk/by-serial/My_Passport_264F-2226FD401XXX",
"/var/run/disk/by-serial/OWC_MEP_Dock_RAID_0-Oil857FXXX",
"/var/run/disk/by-serial/Portable_SSD_T5-029C68654XXX",
"/var/run/disk/by-id/media-5DAA123D-7F5B-3517-A867-3348A0376XXX"
]
}
--Redacted last 3 of serials/uuid
I guess that /var/run/disk/by-id, /var/run/disk/by-path, /var/run/disk/by-serial are not known by many programmers.. I never knew about it until I saw it in scripts for OpenZFS.
As a stop-gap, I have written a small python script that transforms the config that doesn't work to a working one...
I just have the config that doesn't work on etcher as config-drive.json in my ~/Library/Application Support/balena-etcher/ folder, then I run this python script before I open etcher.
#!/usr/bin/env python3
import json
import os
filename = "~/Library/Application Support/balena-etcher/config-drive.json"
newfile = "~/Library/Application Support/balena-etcher/config.json"
with open(os.path.expanduser(filename), "r") as f:
data = json.load(f)
blocklist = data["driveBlacklist"]
blocklistdev = []
for x in blocklist:
y = os.path.realpath(x)
blocklistdev.append(y)
data["driveBlacklist"] = blocklistdev
with open(os.path.expanduser(newfile), "w") as f:
json.dump(data, f, indent=2)
print('Added ' + ', '.join(str(e) for e in blocklistdev) + ' to etcher blocklist.')