Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: jbbum on June 26, 2019, 09:08:40 AM

Title: usb mount
Post by: jbbum 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.
Title: Re: usb mount
Post by: Rich 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.
Title: Re: usb mount
Post by: jbbum on June 26, 2019, 10:07:01 AM
Thanks Rich. 
Title: Re: usb mount
Post by: bmarkus on June 26, 2019, 10:51:34 AM
You can run 'updatefstab' command manually or in a script to update fstab.
Title: Re: usb mount
Post by: Greg Erskine 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.
Title: Re: usb mount
Post by: jbbum 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
Title: Re: usb mount
Post by: Greg Erskine 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
Title: Re: usb mount
Post by: Rich 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.
Title: Re: usb mount
Post by: jbbum 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.
Title: Re: usb mount
Post by: Rich on March 23, 2020, 08:30:22 AM
Hi jbbum
If you are interested, there is an automount script I wrote posted here:
http://forum.tinycorelinux.net/index.php/topic,23337.0.html

I've been running it for about 5 months now and it works quite well.