USB information

Documentation is not my forte. But here is some information about how My Cloud handles USB devices.
WdAutoMountUdevHandler.pm
This script processes udev events for the addition or removal of USB devices and their
associated partitions. It only supports Image and Media Storage Class devices. For
media storage class devices, it only supports partitions with the following filesystems:
ext2, ext3, ext4, fat16, fat32, hfs+, ntfs, and xfs. The script will attempt to mount
and export as a share all partitions of supported filesystems from USB devices when
discovered. When removed, the partitions will be unmounted and their associated shares
will be deleted. For a supported USB device, record information about the device in the USB database, which will be used to obtain device information when their associated partitions are added and to report device information to the controller management client. If the device is not supported, an alert is generated. If the device supports PTP (and not MSC), also create a partition for the device.

The USB database is called AutoMount.db. There seems to be a few copies of this file in different locations. The contents of this is a sqllite format. Below is a sample of what is in the database.

As you can see from the database it keeps a lot of information about the devices that it has mounted. In this output none of these USB devices are currently mounted.

The devices are mounted to two different mount points. The mount points are defined in a file called /etc/nas/AutoMount.conf.
AUTO_MOUNT_MOUNT_DIR="/var/media"
AUTO_MOUNT_SHARES_DIR="/shares"

This is my observation. It seems that the last name of the mount point is whats in the model
field of the database.

When a USB device is mounted log entries are placed in the file /var/log/wdnas.log.
2016-01-06T16:20:23.863132-05:00 di=WfOf5hjVLP info logger: INFO: Device added: device=7, vendor=Samsung Electronics Co., Ltd., model=SM-N910T, serial_number=RF8G401RRLY, revision=N910TUVU2DOK2
2016-01-06T16:20:46.566806-05:00 di=WfOf5hjVLP info logger: updateShareBindMntDir.sh:–add SM_N910T
2016-01-06T16:20:52.560419-05:00 di=WfOf5hjVLP info logger: INFO: Partition added: device=7, partition=1, share_name=SM_N910T, label=, type=fuse.gphotofs,
uuid=RF8G401RRLY
2016-01-06T16:22:26.539267-05:00 di=WfOf5hjVLP info logger: updateShareBindMntDir.sh:–delete SM_N910T
2016-01-06T16:22:27.134591-05:00 di=WfOf5hjVLP info logger:updateShareBindMntDir.sh:umount succeded
2016-01-06T16:22:37.969548-05:00 di=WfOf5hjVLP info logger: INFO: Partition removed (implied): device=7, partition=1, share_name=SM_N910T, label=, type=fuse.gphotofs, uuid=RF8G401RRLY
2016-01-06T16:22:40.262270-05:00 di=WfOf5hjVLP info logger: INFO: Device removed: device=7, vendor=Samsung Electronics Co., Ltd., model=SM-N910T, serial_number=RF8G401RRLY, revision=N910TUVU2DOK2

This is the data entered into the log when I connected my Samsung Galaxy Note 4 to the My Cloud. It created a a SM-N910T directory. It tried to create a “Samsung Android” directory. But every time I did a df it would display and error “Samsung Android” missing.

This is what I have found out so far.

RAC

1 Like

rac8006, thanks for posting this. As one of the few who are having USB problems with certain external USB drives that we try to attach to the USB port on the My Cloud, I’ve (on and off) been digging through the firmware trying to trace my issue of the USB drive being seen, treated as read only, then not mounted by the My Cloud. I’ve seen some of the information you’ve postd. This information is informative in helping further track down certain USB issues.

If you want you can copy the autoMount.db to /nfs/Public. Download a program called sqlitebrowser. Located at https://github.com/sqlitebrowser/sqlitebrowser/releases
Then open the autoMount.db and clock on browse data.
The wdAutoMountUdevHandler.pm is located in /usr/local/sbin. Copy it to /nfs/Public.
Open it with notepad++. At line 112 is where it tests if the device is supported. At line133
it send an alert and logs a warning.
What do these messages say?

RAC

Thanks already have viewed the autoMount.db file in the past while trying to isolate my issue. Will look at the wdAutoMountUdevHandler.pm file when I have a chance.

Don’t forget to post the alert and log messages. Would be nice to see what devices fail.

RAC

PS anybody else having problems with USB devices also post the alert messages

I’ve posted some logs to the following older thread…

https://community.wd.com/t/usb-my-book-not-recognized-reporting-0k-available/96850

I don’t know whether to start a new topic or not. Don’t want people to miss this info.
More information on USB mounting.
When mounting a USB device. The default share name will be “volume”. Otherwise it starts by looking at the label . If it is null then use model. If null then use vendor. If null use the default.
The max share name is limited to the first 32 characters. If the share name is the same as an already mounted USB. Then the share name will have _1 added to the name. That number will be incremented by 1 until an unused share name is found. When the “Unable to create share” alert is received. A message is logged to /var/log/user.log file. The following message could be posted:
Mount directory already exists
Mount directory already mounted
Mount directory not empty
Unable to umount directory

Also after verifying that its ok to create the directory a mkdir -p <directoryname is performed. If it fails you will not get a log entry but you will get the Unable to create share.

Currently only fuse.gphotofs,ntfs|hfsplus,vfat and ext[23]. Which if I read that correctly only ext2 and ext3 is supported not ext4.

Edit: I just verified ext4 drives will mount. Also verified that you can pull the drive without ejecting and it mounts

RAC

Keep up the good work RAC, but I don’t have a USB problem anymore and thereby there will be no more whining from I until the next firmware update.