fix(storage): use /host-dev for block device access inside container
Docker always creates a fresh tmpfs at /dev, silently dropping any /dev:/dev bind mount. Block devices must be accessed via /host-dev where the host /dev is actually mounted. Changes: - docker-compose.yml: /dev:/dev → /dev:/host-dev:rw - safety.go: add HostDevPath constant + HostDevicePath() helper - format_linux.go: all device ops (stat, sfdisk, partprobe, mkfs.ext4, blkid) use HostDevicePath() to resolve /dev/sdb → /host-dev/sdb - safety_linux.go: IsSystemDisk() stats device via /host-dev - scan_linux.go: enrichWithBlkid() probes each partition individually via /host-dev/sdXN instead of batch blkid -o export (which can't find devices when /dev is Docker's minimal tmpfs) Fixes "stat /dev/sdb: no such file or directory" in FormatAndMount. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,8 +30,8 @@ services:
|
||||
- /etc/os-release:/host/etc/os-release:ro
|
||||
# Host hostname — for monitoring page (os.Hostname() returns container ID)
|
||||
- /etc/hostname:/host/etc/hostname:ro
|
||||
# Block devices — required for storage init (lsblk, mkfs, sfdisk)
|
||||
- /dev:/dev
|
||||
# Block devices — mounted at /host-dev (can't override Docker's /dev tmpfs)
|
||||
- /dev:/host-dev:rw
|
||||
# Host fstab — UUID-based mount persistence (mounted as /host-fstab inside container)
|
||||
- /etc/fstab:/host-fstab
|
||||
# udev metadata — for blkid/lsblk device model info
|
||||
|
||||
Reference in New Issue
Block a user