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

DietPi + AmiBerry | Auto usbmount #501

Closed
Fourdee opened this issue Sep 7, 2016 · 10 comments
Closed

DietPi + AmiBerry | Auto usbmount #501

Fourdee opened this issue Sep 7, 2016 · 10 comments
Assignees
Milestone

Comments

@Fourdee
Copy link
Collaborator

Fourdee commented Sep 7, 2016

check if usbmount is compatible with our existing mounting system (manual in fstab). If it is, we can add the package by default to installation.
If not, i'll need to have a look and see what we can do to help users transfers files from USB drive, whilst being compatible with our "dedicated USB drive / user data" system.

@Fourdee
Copy link
Collaborator Author

Fourdee commented Sep 7, 2016

@midwan

Q: Are the users trying to:

  • Copy their .rom/.adf from a USB drive to the SD card?

or

  • Run .rom/.adf directly from an existing USB drive?

or

  • Both?

@midwan
Copy link

midwan commented Sep 7, 2016

The most common scenario will be to:

  • Plug in USB device which contains ROMs, ADFs, HDFs, etc.
  • Copy those on the SD Card for use with the emulator

Many people prefer to get a large sd card (e.g. 8 or 16GB) and store everything in it, so they don't have to plug in anything extra after that.

Of course, the option to have the external USB device used "as-is" is very good, but most users are not familiar with that at the moment. I believe once they pick up on that, they might start using it more and more (maybe I should write a howto specifically for that).

@Fourdee
Copy link
Collaborator Author

Fourdee commented Sep 7, 2016

Notes: usbmount

🈯 | Existing dedicated USB drive setup with DietPi

  • Automatically mounts USB drive as per fstab, when plugged in.
  • Mount location is correct /mnt/usb_1

🈯 : | No existing USB drive

  • Automatically mounts USB drive to /media/usb0

Works in harmony with /etc/fstab, great stuff.

@Fourdee
Copy link
Collaborator Author

Fourdee commented Sep 7, 2016

Notes to self:
Increases filesystem total by 606KB.
Install by default on all DietPi systems?

Fourdee referenced this issue Sep 7, 2016
@midwan
Copy link

midwan commented Sep 7, 2016

Please check if you've also got filesystem support available, for FAT16, FAT32, NTFS...

@Fourdee
Copy link
Collaborator Author

Fourdee commented Sep 7, 2016

Please check if you've also got filesystem support available, for FAT16, FAT32, NTFS...

Yep. Our image supports vfat/ntfs/ext* as standard.
However, ntfs isnt enabled by default in usbmount.conf:

root@DietPi:~# cat /etc/usbmount/usbmount.conf | grep FILESYSTEM
FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus"

I'll add that in and test ntfs. https://github.com/rbrito/usbmount#the-special-case-of-fuse-filesystems

USBmount + ntfs does not currently work in Jessie, workaround:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774149#177

@Fourdee
Copy link
Collaborator Author

Fourdee commented Sep 7, 2016

NTFS support for USBmount on Jessie, based on: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774149#177

        sed -i '/^FILESYSTEMS=/c\FILESYSTEMS="vfat ext2 ext3 ext4 hfsplus ntfs-3g fuseblk"' /etc/usbmount/usbmount.conf
        cat << _EOF_ > /etc/udev/rules.d/usbmount.rules
KERNEL=="sd*", DRIVERS=="sbp2",         ACTION=="add",  PROGRAM="/bin/systemd-escape -p --template=usbmount@.service \$env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c"
KERNEL=="sd*", SUBSYSTEMS=="usb",       ACTION=="add",  PROGRAM="/bin/systemd-escape -p --template=usbmount@.service \$env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c"
KERNEL=="ub*", SUBSYSTEMS=="usb",       ACTION=="add",  PROGRAM="/bin/systemd-escape -p --template=usbmount@.service \$env{DEVNAME}", ENV{SYSTEMD_WANTS}+="%c"
KERNEL=="sd*",                          ACTION=="remove",       RUN+="/usr/share/usbmount/usbmount remove"
KERNEL=="ub*",                          ACTION=="remove",       RUN+="/usr/share/usbmount/usbmount remove"
_EOF_

        cat << _EOF_ > /etc/systemd/system/usbmount@.service
[Unit]
BindTo=%i.device
After=%i.device

[Service]
Type=oneshot
TimeoutStartSec=0
Environment=DEVNAME=%I
ExecStart=/usr/share/usbmount/usbmount add
RemainAfterExit=yes
_EOF_

systemctl daemon-reload

Result

root@DietPi:~# blkid
...
/dev/sda1: UUID="A898219D98216AD0" TYPE="ntfs"

root@DietPi:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda1       7.3G   23M  7.2G   1% /media/usb0

Write test

root@DietPi:~# echo 1 > /media/usb0/test

root@DietPi:~# ls -lha /media/usb0/test
-rw-r--r-- 1 root root 2 Sep  7 14:50 /media/usb0/test

And now, just stopped working:

Sep  7 15:22:53 DietPi kernel: [   44.695979]  sda: sda1
Sep  7 15:22:53 DietPi kernel: [   44.703815] sd 1:0:0:0: [sda] Attached SCSI removable disk
Sep  7 15:22:53 DietPi systemd[1]: Starting usbmount@dev-sda.service...
Sep  7 15:22:53 DietPi systemd[1]: Starting usbmount@dev-sda1.service...
Sep  7 15:22:53 DietPi usbmount[1719]: loaded usbmount configurations
Sep  7 15:22:53 DietPi usbmount[1719]: trying to acquire lock /var/run/usbmount/.mount.lock
Sep  7 15:22:53 DietPi usbmount[1730]: loaded usbmount configurations
Sep  7 15:22:53 DietPi usbmount[1719]: acquired lock /var/run/usbmount/.mount.lock
Sep  7 15:22:53 DietPi usbmount[1730]: trying to acquire lock /var/run/usbmount/.mount.lock
Sep  7 15:22:53 DietPi usbmount[1719]: dev/sda does not contain a filesystem or disklabel
Sep  7 15:22:53 DietPi systemd[1]: usbmount@dev-sda.service: main process exited, code=exited, status=1/FAILURE
Sep  7 15:22:53 DietPi systemd[1]: Failed to start usbmount@dev-sda.service.
Sep  7 15:22:53 DietPi systemd[1]: Unit usbmount@dev-sda.service entered failed state.
Sep  7 15:22:58 DietPi usbmount[1730]: acquired lock /var/run/usbmount/.mount.lock
Sep  7 15:22:58 DietPi usbmount[1730]: dev/sda1 contains filesystem type ntfs
Sep  7 15:22:58 DietPi usbmount[1730]: usbmount execution finished
Sep  7 15:22:58 DietPi systemd[1]: Started usbmount@dev-sda1.service.

Formatted to NTFS and provided a disk label test

Sep  7 15:27:18 DietPi usbmount[1949]: acquired lock /var/run/usbmount/.mount.lock
Sep  7 15:27:18 DietPi usbmount[1949]: dev/sda1 contains filesystem type ntfs
Sep  7 15:27:18 DietPi usbmount[1949]: usbmount execution finished
Sep  7 15:27:18 DietPi systemd[1]: Started usbmount@dev-sda1.service.

But not visible in df

Intermittent results with NTFS.

@Fourdee
Copy link
Collaborator Author

Fourdee commented Sep 7, 2016

Ok could probably do this with just systemD using auto FStype and automount:

/dev/sda1       /mnt/usb_1      auto     defaults,noatime,nofail,permissions,x-systemd.automount  0       0

Fourdee referenced this issue Sep 7, 2016
+ Revert usbmount.
+ Testing systemD automount with auto FS type feature:
https://github.com/Fourdee/DietPi/issues/501
@Fourdee
Copy link
Collaborator Author

Fourdee commented Sep 7, 2016

Only downside is:

  • Cant use permissions mount attribute thats used only by NTFS drives. As this prevents other FS types from mounting (eg: ext4).

Fourdee referenced this issue Sep 7, 2016
+ Automount USB drives via systemD:
https://github.com/Fourdee/DietPi/issues/501
@Fourdee
Copy link
Collaborator Author

Fourdee commented Sep 7, 2016

Done, automount works with:

  • NTFS
  • VFAT
  • EXT*

Also worth noting these changes will help with setting up multiple drives: https://github.com/Fourdee/DietPi/issues/271

EDIT: And this will be patched on users system during v131 dietpi-update
EDIT2: And mount locations will be /mnt/usb_[index]

@Fourdee Fourdee closed this as completed Sep 7, 2016
This was referenced Sep 19, 2016
Fourdee referenced this issue Sep 20, 2016
v131
(20/09/16)

New Image:

OrangePi One | Is now available. Implementation possible, with thanks to K-Plan: http://dietpi.com/download

New Features:

DietPi-Drive_Manager | Lightweight Drive Manager (eg: gparted). Allows you to mount, dismount, format EXT4/NTFS/FAT32/HFS+/BTRFS, toggle UUID mounting and control multiple (max 5) external/USB drives, for use on your DietPi system: https://github.com/Fourdee/DietPi/issues/271

Changes / Improvements / Optimizations:

DietPi-Software | Added installation options for NFS server and client: https://github.com/Fourdee/DietPi/issues/246

DietPi-Software | Added installation options for UrBackup Server: https://github.com/Fourdee/DietPi/issues/494

DietPi-Software | CertBot will now automatically install required packages, rather than prompt user.

DietPi-Software | Emby Media Server is now available for BPi M2+ BPi Pro and OPi PC. Thanks to John for testing with his BPi Pro (M1): http://dietpi.com/phpbb/viewtopic.php?f=11&t=644&p=2860#p2853

DietPi-Config | Added ability to mount NFS shares in Networking: NAS menu.

Raspberry Pi | Image download updated to v131: http://dietpi.com/download

Raspberry Pi | Image v131. We have changed from the unstable, unreliable and slow Raspbian Mirror Director, to Oxford UK Mirror: https://github.com/Fourdee/DietPi/issues/518. Requires v131 image or higher.

General | When inserting one USB drive to system, it will be mounted automaticaly to /mnt/usb_1 when plugged in: https://github.com/Fourdee/DietPi/issues/501

General | Dedicated USB drive setup will now set the UUID in /etc/fstab

General | HFS+ filesystem is now supported on all DietPi images.

General | You can now check bootup time duration, by running 'cat /var/log/boottime'. This is the duration from boot, to when SystemD has finished. TIP: Boot times can vastly be reduced, by using a static IP address.

DietPi-Lets_Encrypt | Now supports Apache2 and Lighttpd webserver stacks: https://github.com/Fourdee/DietPi/issues/479. Many thanks to aar0nism for posting a excellent guide we based this on: http://dietpi.com/phpbb/viewtopic.php?f=9&t=603&p=2625#p2624

Bug fixes:

DietPi-Software | Resolved an issue where FFMPEG did not install libmp3lame0 on RPi 1. Many thanks to Erayan for reporting this: https://github.com/Fourdee/DietPi/issues/511

DietPi-Software | Automatic moving of user data is now limited to 1st run installation only.

DietPi-Config | Resolved an issue where static IP WiFi connections failed to route data: https://github.com/Fourdee/DietPi/issues/515

DietPi-Cloudshell | Resolved an issue where the Storage scene would hang, if a unavailable NFS mount 
was used as custom USB device. Many thanks to John for reporting and testing this: https://github.com/Fourdee/DietPi/issues/395

DietPi-Automation | Resolved an issue where connection tests would not wait 1 second, before trying again. This occured when there was no available network.

Image | We have found a possible image/filesystem corruption on our Odroid C2 image. The image has been reverted back to a previous stable image and updated to v130: https://github.com/Fourdee/DietPi/issues/507

General | Resolved an issue where setting snd-bcm2835 soundcard did not set avoid_pwm_pll=0 (to allow HQ audio).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants