WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: usb mount  (Read 1232 times)

Offline jbbum

  • WikiUser
  • *
  • Posts: 4
usb mount
« on: June 26, 2019, 09:08:40 AM »
Where and how does piCore update fstab when usb device is attached.  Would like to add a mount command to the fstab update function.

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6846
Re: usb mount
« Reply #1 on: June 26, 2019, 09:25:23 AM »
Hi jbbum
The update is initiated by  udev. I think it happens in  /etc/udev/rules.d/98-tc.rules.  Look for the lines containing  rebuildfstab.

Offline jbbum

  • WikiUser
  • *
  • Posts: 4
Re: usb mount
« Reply #2 on: June 26, 2019, 10:07:01 AM »
Thanks Rich. 

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7003
    • My Community Forum
Re: usb mount
« Reply #3 on: June 26, 2019, 10:51:34 AM »
You can run 'updatefstab' command manually or in a script to update fstab.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 269
Re: usb mount
« Reply #4 on: June 26, 2019, 01:47:36 PM »
Just a couple of points, I think...

/etc/fstab is dynamically created during the boot process by rebuildfstab, unless the nofstab bootcode is set .

Mounts have "noauto" option set automatically so $ mount -a isn't much use.

Offline jbbum

  • WikiUser
  • *
  • Posts: 4
Re: usb mount
« Reply #5 on: June 26, 2019, 04:52:06 PM »
I added a mount command at approximate line #88 in rebuildfstab to mount $DEVNAME.  Added it in the if statement that checks if device is already mounted and right after the mkdir command.

mount /dev/$DEVNAME /mnt/$DEVNAME

This automounts usb devices for a photo frame controlled by python

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 269
Re: usb mount
« Reply #6 on: June 26, 2019, 06:36:03 PM »
hi jbbum,

It might be better if you add your mount command in /opt/bootsync.sh. This gets backed up and will be persistent. /opt/bootsync.sh and /opt/bootlocal.sh are there for adding commands that need to run at startup.

Usually, it's best not to modify TinyCore/piCore commands.

I haven't used piCore for a while, but there was a stage where USB drives did automatically mount, via udev I think.

rebuildfstab runs during the boot process and also when you hot plug USB disks.

The mount command can be just $ mount /dev/$DEVNAME as the command uses the mount point found in /etc/fstab.

regards
Greg

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 6846
Re: usb mount
« Reply #7 on: June 26, 2019, 07:27:22 PM »
Hi Greg Erskine
... I haven't used piCore for a while, but there was a stage where USB drives did automatically mount, via udev I think. ...
I think that's what he is looking to accomplish, auto mounting USB drives when they get plugged in.

Offline jbbum

  • WikiUser
  • *
  • Posts: 4
Re: usb mount
« Reply #8 on: June 27, 2019, 09:46:12 AM »
Rich,  that is exactly the procedure I am trying to do.  My python script reads the dirs in /mnt and provides a button to open and display the images from that dir.  So when a usb drive is inserted the images are available to the photoframe.  This is all done on a touch screen, no keyboard.