Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [SambaNAS] Can't mount WD My Passport in NTFS, can't find why #236

Closed
purierca opened this issue Apr 26, 2024 · 4 comments
Closed

🐛 [SambaNAS] Can't mount WD My Passport in NTFS, can't find why #236

purierca opened this issue Apr 26, 2024 · 4 comments
Labels
bug Something isn't working no-issue-activity

Comments

@purierca
Copy link

Addon

SambaNAS

Description

I think I've followed all the documentation. I have screen through the discussions and issues on Github and in the HA community forum, can't find an answer...

Reproduction steps

1. Plugged WD My Passport (NTFS) in HA Green
2. Install Samba NAS, configure it, can access it from local Windows machine
3. Only see the standard folders in network access, WD My Passport not mounted
4. See error

Addon Logs

[16:50:51] INFO: Mounting disks:

	My Passport
---------------------------------------------------
[16:50:52] WARNING: Your My Passport is ntfs. This is an EXPERIMENTAL support
mount: /mnt/My Passport: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error.
       dmesg(1) may have more information after failed mount system call.
[16:50:54] WARNING: Fail to mount My Passport nosuid,relatime,noexec !

Addon Config

workgroup: WORKGROUP
username: homeassistant
allow_hosts:
  - 10.0.0.0/8
  - 172.16.0.0/12
  - 192.168.0.0/16
  - 169.254.0.0/16
  - fe80::/10
  - fc00::/7
  - 2a01:cb10:8b4d:b700:690f:e54c:58d7:ddbe
automount: true
moredisks:
  - My Passport
mountoptions:
  - nosuid
  - relatime
  - noexec
available_disks_log: true
medialibrary:
  enable: true
veto_files:
  - ._*
  - .DS_Store
  - Thumbs.db
  - icon?
  - .Trashes
compatibility_mode: false
recyle_bin_enabled: true
wsdd2: false
mqtt_nexgen_entities: true
autodiscovery: {}
other_users: []
acl: []
interfaces: []
password: Supercece0
enable_smart: true
mqtt_enable: true

Architecture

other

OS

HaOS

@purierca purierca added the bug Something isn't working label Apr 26, 2024
@dianlight
Copy link
Owner

Please post full addon log. I'm not a future teller.

Can be a bug or the ntfs driver that don't work well with spaces in labels. Try to mount by uuid or relabel without spaces.

L.

@purierca
Copy link
Author

Hi there L
Thanks a lot for taking the time to answer. I've tried changing the disk name without spaces and then tried with uuid, to no change.
Here's the full log:



[20:09:50] INFO: Mounting disks:

My Passport

[20:09:50] WARNING: Your My Passport is ntfs. This is an EXPERIMENTAL support
mount: /mnt/My Passport: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error.
dmesg(1) may have more information after failed mount system call.
[20:09:50] WARNING: Fail to mount My Passport nosuid,relatime,noexec !
s6-rc: info: service init-automount successfully started
s6-rc: info: service init-smartd: starting
s6-rc: info: service init-samba: starting
s6-rc: info: service hd-idle: starting
s6-rc: info: service hd-idle successfully started
[20:09:50] INFO: Hostname: homeassistant
[20:09:51] INFO: Interfaces: end0
[20:09:51] INFO: Enabling S.M.A.R.T for /dev/sda
smartctl 7.4 2023-08-01 r5530 [aarch64-linux-6.6.25-haos] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

[20:09:51] INFO: Docker Interface: hassio 172.30.32.0/23
=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.
SMART Attribute Autosave Enabled.
tdbsam_open: Converting version 0.0 database to version 4.0.
tdbsam_convert_backup: updated /var/lib/samba/private/passdb.tdb file.
Added user homeassistant.
SMART Automatic Timers not supported

SMART Enable Automatic Offline failed: scsi error aborted command

s6-rc: info: service init-smartd successfully started
Added user ha_mount_user.

[20:09:52] INFO: Exposed Disks Summary:
[CONFIG] path = /homeassistant # TM:false FS:native RECYCLEBIN #
[ADDONS] path = /addons # TM:false FS:native RECYCLEBIN #
[SSL] path = /ssl # TM:false FS:native RECYCLEBIN #
[SHARE] path = /share # TM:false FS:native RECYCLEBIN #
[BACKUP] path = /backup # TM:false FS:native RECYCLEBIN #
[MEDIA] path = /media # TM:false FS:native RECYCLEBIN #
[ADDON_CONFIGS] path = /addon_configs # TM:false FS:native RECYCLEBIN #

s6-rc: info: service init-samba successfully started
s6-rc: info: service init-mqtt: starting
s6-rc: info: service wsdd: starting
s6-rc: info: service smbd: starting
s6-rc: info: service nmbd: starting
s6-rc: info: service avahi: starting
s6-rc: info: service smbd successfully started
s6-rc: info: service nmbd successfully started
s6-rc: info: service wsdd successfully started
s6-rc: info: service cifs-supervisor-mount: starting
s6-rc: info: service avahi successfully started
[20:09:52] INFO: Automount Shares...
[20:09:52] INFO: Starting the AVAHI for homeassistant...
Waiting for daemon ...
nmbd version 4.18.9 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023
[20:09:52] INFO: Starting the wsdd daemon for WORKGROUP/homeassistant...
smbd version 4.18.9 started.
Copyright Andrew Tridgell and the Samba Team 1992-2023
INFO: Profiling support unavailable in this build.
[20:09:52] INFO: Wait Samba Server to going up..(max 30s)
[20:09:52] INFO: Interfaces: -i end0
s6-rc: info: service init-mqtt successfully started
2024-04-28 20:09:53,433:wsdd INFO(pid 370): using pre-defined UUID cb6a33a0-b841-531d-a34e-09ecec492eb1
2024-04-28 20:09:53,439:wsdd INFO(pid 370): joined multicast group 239.255.255.250 on 192.168.1.28%end0
2024-04-28 20:09:53,448:wsdd INFO(pid 370): scheduling Hello message via end0 to 239.255.255.250%end0
2024-04-28 20:09:53,465:wsdd INFO(pid 370): joined multicast group [ff02::c] on fe80::c9f5:b2d9:8c01:66d4%end0
2024-04-28 20:09:53,468:wsdd INFO(pid 370): scheduling Hello message via end0 to ff02::c%end0

No locked files
Samba version 4.18.9
PID Username Group Machine Protocol Version Encryption Signing

Service pid Machine Connected at Encryption Signing

s6-rc: info: service cifs-supervisor-mount successfully started
s6-rc: info: service mqtt-disk-handler: starting
s6-rc: info: service mqtt-disk-handler successfully started
s6-rc: info: service mqtt-handler: starting
s6-rc: info: service mqtt-handler successfully started
s6-rc: info: service legacy-services: starting
2024-04-28 20:09:53,795:wsdd INFO(pid 370): 192.168.1.23 - - "POST /cb6a33a0-b841-531d-a34e-09ecec492eb1 HTTP/1.1" 200 -
2024-04-28 20:09:53,845:wsdd INFO(pid 370): 192.168.1.19 - - "POST /cb6a33a0-b841-531d-a34e-09ecec492eb1 HTTP/1.1" 200 -
2024-04-28 20:09:53,869:wsdd INFO(pid 370): fe80::98a8:519d:29f8:a04d - - "POST /cb6a33a0-b841-531d-a34e-09ecec492eb1 HTTP/1.1" 200 -
[20:09:53] INFO: Starting the MQTT daemon for partitions info...
s6-rc: info: service legacy-services successfully started
[20:09:53] INFO: New MQTT integration


Samba name server HOMEASSISTANT is now a local master browser for workgroup WORKGROUP on subnet 172.30.32.1


@purierca
Copy link
Author

purierca commented Apr 29, 2024

FYI I've found a workaround with a solution posted by user 'paoloantinori' on the HA Community at this link, which allows for the mounting of any NTFS via USD or SSD directly as network storage in HA. It's then available for sharing through SambaNAS.

I'm taking the liberty of copy pasting his post here for reference for anybody looking for a solution in this repo, but full credits to paoloantironi:

Working on:

Home Assistant 2022.9.0
Supervisor 2022.08.6
Operating System 8.5
Frontend 20220907.0 - latest

Format a USB and call it CONFIG. Create a folder inside called udev. Create a text file and call it:
80-mount-usb-to-media-by-label.rules

Make sure you overwrite the .txt file extension. Open this with notepad, and paste the following in

This version is if you are booting from an SD Card

#
# udev rule
#   Mount USB drive to the media directory using the partition name as mount point
#
# Description:
#   Created for Home Assistant OS, this rule mounts any USB drives
#   into the Hassio media directory (/mnt/data/supervisor/media).
#   When a USB drive is connected to the board, the rule creates one directory
#   per partition under the media directory. The newly created partition is named
#   as the partition name. If the partition does not have a name, then the following
#   name format is used: "usb-{block-name}" where the block name is sd[a-z][0-9].
#
# Note 1:
#   The rule name is always prefixed with a number. In this case, the rule uses 80.
#   This represents the order of the rule when multiple rules exists in udev.
#   Low numbers run first, high numbers run last. However, low numbers do not have all
#   the facilities than high numbers may have.
#   For this rule to run properly, use numbers equal or greater than 80.
#
# Note 2:
#   This rule will skip mounting the 'CONFIG' USB key.
#   https://github.com/home-assistant/operating-system/blob/a6445af71282045c2ea92f1dea8d2f9e518bd008/Documentation/configuration.md
#
# Note 3:
#   This rule will mount the OS partitions if the OS is sorted on a USB drive (i.e. USB booting).
#   To prevent this issue from happening, update the rule to skip the booting USB drive.
#   See the CAUTION message below.
#
# Source of inspiration:
#   https://www.axllent.org/docs/auto-mounting-usb-storage/
#
# Useful links:
#   https://wiki.archlinux.org/index.php/Udev
#
# udev commands:
#   - Restart udev to reload new rules:
#       udevadm control --reload-rules
#   - List device attributes of sdb1:
#       udevadm info --attribute-walk --name=/dev/sdb1
#   - List environment variables of sdb1:
#       udevadm info /dev/sdb1
#   - Trigger add/remove event for sdb1:
#       udevadm trigger --verbose --action=add --sysname-match=sdb1
#       udevadm trigger --verbose --action=remove --sysname-match=sdb1
#


# Filter on block devices, exit otherwise
# CAUTION: Change to 'sd[a-z][0-9]' if booting from a USB drive (e.g.: sda)
KERNEL!="sd[b-z][0-9]", GOTO="abort_rule"

# Skip none USB devices (e.g.: internal SATA drive)
ENV{ID_PATH}!="*-usb-*", GOTO="abort_rule"

# Import the partition info into the environment variables
IMPORT{program}="/usr/sbin/blkid -o udev -p %N"

# Exit if partition is not a filesystem
ENV{ID_FS_USAGE}!="filesystem", GOTO="abort_rule"

# Exit if this is the 'CONFIG' USB key
ENV{ID_FS_LABEL}=="CONFIG", GOTO="abort_rule"

# Get the partition name if present, otherwise create one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usb-%k"

# Determine the mount point
ENV{mount_point}="/mnt/data/supervisor/media/%E{dir_name}"

# If filesystem is ntfs, use the ntfs3 driver, so we get rw support
# Home Assistant Operating System 8.0 or later required (linux kernel 5.15)
ENV{ID_FS_TYPE}=="ntfs", ENV{fstype}="-t ntfs3"
ENV{ID_FS_TYPE}!="ntfs", ENV{fstype}="-t auto"

# Mount the device on 'add' action (a.k.a. plug the USB drive)
ACTION=="add", RUN{program}+="/usr/bin/mkdir -p %E{mount_point}", RUN{program}+="/usr/bin/systemd-mount %E{fstype} --no-block --automount=no --collect $devnode %E{mount_point}"

# Umount the device on 'remove' action (a.k.a unplug or eject the USB drive)
ACTION=="remove", ENV{dir_name}!="", RUN{program}+="/usr/bin/systemd-umount %E{mount_point}", RUN{program}+="/usr/bin/rmdir %E{mount_point}"

# Exit
LABEL="abort_rule"

This version is if you are booting from an SSD via USB

#
# udev rule
#   Mount USB drive to the media directory using the partition name as mount point
#
# Description:
#   Created for Home Assistant OS, this rule mounts any USB drives
#   into the Hassio media directory (/mnt/data/supervisor/media).
#   When a USB drive is connected to the board, the rule creates one directory
#   per partition under the media directory. The newly created partition is named
#   as the partition name. If the partition does not have a name, then the following
#   name format is used: "usb-{block-name}" where the block name is sd[a-z][0-9].
#
# Note 1:
#   The rule name is always prefixed with a number. In this case, the rule uses 80.
#   This represents the order of the rule when multiple rules exists in udev.
#   Low numbers run first, high numbers run last. However, low numbers do not have all
#   the facilities than high numbers may have.
#   For this rule to run properly, use numbers equal or greater than 80.
#
# Note 2:
#   This rule will skip mounting the 'CONFIG' USB key.
#   https://github.com/home-assistant/operating-system/blob/a6445af71282045c2ea92f1dea8d2f9e518bd008/Documentation/configuration.md
#
# Note 3:
#   This rule will mount the OS partitions if the OS is sorted on a USB drive (i.e. USB booting).
#   To prevent this issue from happening, update the rule to skip the booting USB drive.
#   See the CAUTION message below.
#
# Source of inspiration:
#   https://www.axllent.org/docs/auto-mounting-usb-storage/
#
# Useful links:
#   https://wiki.archlinux.org/index.php/Udev
#
# udev commands:
#   - Restart udev to reload new rules:
#       udevadm control --reload-rules
#   - List device attributes of sdb1:
#       udevadm info --attribute-walk --name=/dev/sdb1
#   - List environment variables of sdb1:
#       udevadm info /dev/sdb1
#   - Trigger add/remove event for sdb1:
#       udevadm trigger --verbose --action=add --sysname-match=sdb1
#       udevadm trigger --verbose --action=remove --sysname-match=sdb1
#


# Filter on block devices, exit otherwise
# CAUTION: Change to 'sd[b-z][0-9]' if booting from a USB drive (e.g.: sda)
KERNEL!="sd[b-z][0-9]", GOTO="abort_rule"

# Skip none USB devices (e.g.: internal SATA drive)
ENV{ID_PATH}!="*-usb-*", GOTO="abort_rule"

# Import the partition info into the environment variables
IMPORT{program}="/usr/sbin/blkid -o udev -p %N"

# Exit if partition is not a filesystem
ENV{ID_FS_USAGE}!="filesystem", GOTO="abort_rule"

# Exit if this is the 'CONFIG' USB key
ENV{ID_FS_LABEL}=="CONFIG", GOTO="abort_rule"

# Get the partition name if present, otherwise create one
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usb-%k"

# Determine the mount point
ENV{mount_point}="/mnt/data/supervisor/media/%E{dir_name}"

# If filesystem is ntfs, use the ntfs3 driver, so we get rw support
# Home Assistant Operating System 8.0 or later required (linux kernel 5.15)
ENV{ID_FS_TYPE}=="ntfs", ENV{fstype}="-t ntfs3"
ENV{ID_FS_TYPE}!="ntfs", ENV{fstype}="-t auto"

# Mount the device on 'add' action (a.k.a. plug the USB drive)
ACTION=="add", RUN{program}+="/usr/bin/mkdir -p %E{mount_point}", RUN{program}+="/usr/bin/systemd-mount %E{fstype} --no-block --automount=no --collect $devnode %E{mount_point}"

# Umount the device on 'remove' action (a.k.a unplug or eject the USB drive)
ACTION=="remove", ENV{dir_name}!="", RUN{program}+="/usr/bin/systemd-umount %E{mount_point}", RUN{program}+="/usr/bin/rmdir %E{mount_point}"

# Exit
LABEL="abort_rule"

Plug your USB in, and navigate to:

yourHAIPaddress:8123/hassio/system/info

This will take you to the Supervisor menu that’s disappeared from the left bar in current HA versions.

In the Host box, look at the bottom for Reboot Host & Shutdown Host buttons - to the right is a burger menu, click this and ‘Import for USB’

Refresh the log below and you should see:

22-09-08 13:46:38 INFO (MainThread) [supervisor.os.manager] Synchronizing configuration from USB with Home Assistant Operating System.
22-09-08 13:46:38 INFO (MainThread) [supervisor.host.services] Restarting local service hassos-config.service

You can now unplug the USB stick and insert your drive. Give it 30 seconds then check the Media menu on the left bar - you should see your drive. You will not see any contents - Reboot HA and when it comes back up, everything will populate.

You can import these folders to the HA version of Plex Media Server. If you have Samba Share, you can access the HDD in the media folder and write files in.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity
Projects
None yet
Development

No branches or pull requests

2 participants