Automatically mount a network drive from a wireless USB adaptor

08
2014-07
  • Nicolas

    Here's the plan:

    1. I've got a Hi-fi music system that reads music from CDs, iPods, and USBs.
    2. All my music is stored on a NAS (ripped from my CDs)
    3. The NAS is conneted via Ethernet to my Wifi router and has a static IP address

    Is it possible to use a wireless USB adaptor on the Hi Fi system to auto-mount the appropriate folder from my NAS, that way when I plug the wireless USB adaptor to my Hifi it just reads it as a regular USB stick?

  • Answers
  • Dan D.

    It wouldn't work with the setup you describe. You would need a device far more specialized than a USB wireless adapter. The device would need to expose over USB a mass storage device with a FAT32 file-system in it with data in it fetched over wireless from your NAS. No such device is know to exist.

    You are better off getting a device that can stream and decode from your NAS and connect the output of that device into the line-in of your Hi-Fi.


  • Related Question

    linux - RW mounted usb drive regarded read-only by cp
  • Bas Bossink

    Context

    Can any of you help me with the following, I've got a micro sd card inserted via a usb stick into my Compaq 8510w laptop running the latest Arch Linux (x86_64) release. I have a udev rule that automounts the drive upon insert like this:

    KERNEL!="sd[a-z]*", GOTO="media_by_label_auto_mount_end"
    ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="media_by_label_auto_mount_end"
    
    # Get label
    PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c"
    # use basename to correctly handle labels such as ../mnt/foo
    PROGRAM=="/usr/bin/basename '%E{dir_name}'", ENV{dir_name}="%c"
    ENV{dir_name}=="", ENV{dir_name}="usbhd-%k"
    
    ACTION=="add", ENV{dir_name}!="", RUN+="/bin/su bas -c '/usr/bin/pmount %N %E{dir_name}'"
    ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/su bas -c '/usr/bin/pumount /media/%E{dir_name}'"
    LABEL="media_by_label_auto_mount_end"KERNEL!="sd[a-z]*", GOTO="media_by_label_auto_mount_end"
    ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="media_by_label_auto_mount_end"
    LABEL="media_by_label_auto_mount_end"
    

    A verbatim copy of this ArchWiki page, when the usb stick is inserted it gets mounted as reported by mount like so:

    /dev/sdb1 on /media/usbhd-sdb1 type vfat (rw,noexec,nosuid,nodev,quiet,shortname=mixed,uid=1000,gid=1000,umask=077,fmask=0177,dmask=0077,iocharset=iso8859-1)
    

    Read access is fine but when I try to cp a few files to the drive cp reports

    cp: cannot create regular file `/media/usbhd-sdb1/R4iMenu/system.fon': Read-only file system
    

    Things I tried

    • reboot
    • mount -o rw
    • searching the global interweb
    • copying the output of mount to /etc/fstab and fixing the syntax, mount /dev/sdb1

    Any suggestions would be greatly appreciated.

    Thanks.


    Update

    dmesg |tail -15 output after inserting the usb drive:

    usb 2-5: new high speed USB device using ehci_hcd and address 4
    Initializing USB Mass Storage driver...
    scsi5 : usb-storage 2-5:1.0
    usbcore: registered new interface driver usb-storage
    USB Mass Storage support registered.
    scsi 5:0:0:0: Direct-Access     ChipsBnk SD/MMCReader     4081 PQ: 0 ANSI: 2
    sd 5:0:0:0: Attached scsi generic sg2 type 0
    sd 5:0:0:0: [sdb] 7954432 512-byte logical blocks: (4.07 GB/3.79 GiB)
    sd 5:0:0:0: [sdb] Write Protect is off
    sd 5:0:0:0: [sdb] Mode Sense: 0b 00 00 08
    sd 5:0:0:0: [sdb] Assuming drive cache: write through
    sd 5:0:0:0: [sdb] Assuming drive cache: write through
     sdb: sdb1
    sd 5:0:0:0: [sdb] Assuming drive cache: write through
    sd 5:0:0:0: [sdb] Attached SCSI removable disk
    

    Running fsck.vfat

    fsck reports a lot of issues esp. a large number of Bad filename and Start cluster beyond limits .. errors. After completion of fsck the file system can be written to. So my original problem is solved.

    Follow up question

    Is there any log file that reports the fall back to ro mode in case of a corrupt file system, such that I can more easily detect the issue in the future?


  • Related Answers
  • slhck

    This happened to mewhile using a USB SD card reader.

    I created a kubuntu install stick with Universal USB Installer 1.9.2.1 all went well Win 8 When I went to add more files Ubuntu 12.10 to my 8 gig class 10 sd card it came up read only. Went back to Win 8 same thing read only. Looked for regedit lines from on solution my reg had no entry.

    Checked my lock switch and moved it from the position it was allways in to the other position and TADA. Added files went to Ubuntu 12.10 and added files.

    Here is where it gets stranger. I decide to install Kubuntu 12.4.1 so I go to format drive to recreate a install stick with Kubuntu 12.4.1. I try Universal USB Installer 1.9.2.1 with erase disk checked. No go read only again. Try to format Win 8 and no go. Try to format gpart no go. Back to Win 8 change advanced sharing and add my user and select full access for it and the everyone user. Try to format and TADA ! It wipes and I create a Kubuntu 12.4.1 install stick. I install Kubuntu and decide I need a few more files from Win 7 Laptop and no go READ ONLY ! Try everything above again and no go.

    I removed the SD card and plugged it in the Win 7 Laptop card reader slot and it was a normal working normal and has ever since. If I put it in the USB unit it still comes up Read only.