Disks: allow persisting the primary mount from the UI; clean NTFS before mounting.

The Disks page treated /media/wrolpi as fully protected, so a
manually-mounted primary drive could not be persisted from the UI — and
the Persist toggle would have been wrong anyway: it wrote fstab.yaml,
which the wrolpi-mounts reconciler refuses to apply for the primary
mount (RESERVED_MOUNT_POINTS).  Route Persist for the primary mount to
the host's /etc/fstab (as onboarding does), report its entry in the
fstab list endpoint, and enable the toggle in both UIs while keeping
Unmount blocked.  Mounts outside /media (e.g. /boot/efi, which showed
an Unmount button) are now entirely untouchable System mounts.

Also:
- Run `ntfsfix -d` before mounting ntfs/ntfs3 volumes so the Windows
  dirty flag (Fast Startup, unclean unplug) cannot block mounting;
  non-fatal and a no-op on clean volumes.
- Add uid/gid fstab options for ntfs/ntfs3, matching mount_drive().
- Log reconcile diagnostics (desired/already-mounted/skipped with
  reasons) so an idle wrolpi-mounts run explains itself in the journal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-05 14:50:56 -06:00
parent 85bd5619fa
commit c25902b92a
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
11 changed files with 251 additions and 18 deletions

View file

@ -1663,8 +1663,11 @@
<td>
`;
const protectedMounts = ['/', '/boot', '/boot/firmware', '/media/wrolpi'];
const isProtected = protectedMounts.includes(disk.mountpoint);
// The primary mount cannot be unmounted, but its persistence
// (/etc/fstab entry) can be toggled. Mounts outside /media
// (/, /boot/efi, ...) are system mounts: entirely untouchable.
const isPrimary = disk.mountpoint === '/media/wrolpi';
const isSystemMount = mounted && !isPrimary && !disk.mountpoint.startsWith('/media/');
// Check if this disk has a persistent entry (by mount point or UUID)
let isPersistent = false;
@ -1679,7 +1682,7 @@
}
// Persist column - show for mounted drives OR unmounted persistent drives
if ((mounted || isPersistent) && !isProtected) {
if ((mounted || isPersistent) && !isSystemMount) {
const mountPoint = mounted ? disk.mountpoint : persistentEntry.mount_point;
html += `
<label class="toggle">
@ -1697,10 +1700,10 @@
html += `</td><td>`;
// Actions column
if (mounted && !isProtected) {
html += `<button class="btn btn-danger" onclick="unmountDisk('${disk.mountpoint}')">Unmount</button>`;
} else if (mounted && isProtected) {
if (mounted && (isSystemMount || isPrimary)) {
html += `<span style="color: #888;">System</span>`;
} else if (mounted) {
html += `<button class="btn btn-danger" onclick="unmountDisk('${disk.mountpoint}')">Unmount</button>`;
} else {
const defaultMount = disk.label ? `/media/${disk.label}` : `/media/${disk.name}`;
html += `<button class="btn btn-primary" onclick="mountDisk('${disk.path}', '${defaultMount}', '${disk.fstype || ''}')">Mount</button>`;