Fraoch
Posts: 90
Joined: Thu Mar 07, 2013 11:53 pm
Location: Cambridge, Ontario, Canada

Really liking Tiny Core - question about permanently mounting shares

Wed Aug 14, 2019 9:57 pm

I'm running Tiny Core on my Pi1B and I'm trying to get everything working that I usually do. I always mount my main workstation's CIFS share and an NFS share from my FreeNAS.

I figured out how to mount shares in TC temporarily. Works fine.

But mounting them permanently is tricky. The share is mounted through /etc/fstab and I back /etc/fstab on shutdown/restart but the issue is - how to back up the mount point? I want to back up the directory but none of the contents - they obviously won't fit on the SD card and actually end up crashing filetool.

I found that by putting the commands to create this share mount point in /opt/bootlocal.sh I can create the share mount point each time I boot and give it the appropriate permissions but I can't mount /etc/fstab in bootlocal.sh, i.e. "mount -a" doesn't do anything.

I tried "sudo mount -a", "/usr/bin/mount -a" and even explicitly mounting it here rather than in /etc/fstab, i.e.

Code: Select all

mount -t cifs //[server IP]/[share] /home/[mount point] -o guest,file_mode=0777,dir_mode=0777,noperm,defaults
which works fine at the CLI once booted but does not mount the share in bootlocal.sh.

I tried putting these commands in /opt/bootsync.sh which runs commands before anything else is booted, no difference.

Any pointers as to what I'm doing wrong?

Thanks.
Pencoed-made Model 1B, Samsung memory
2B 1.1
3B+
4B 2GB

epoch1970
Posts: 3362
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Really liking Tiny Core - question about permanently mounting shares

Wed Aug 14, 2019 11:56 pm

Mhh. You do have the ability to archive your homedir, don’t you? (I don’t remember the name of the command)
In this case I think you home will be loop-mounted by the time fstab is read. So creating an empty directory in you home and then backing up your home would do the trick.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

k-pi
Posts: 922
Joined: Sun Feb 12, 2017 1:46 pm
Location: Upper Hale, Surrey, UK.

Re: Really liking Tiny Core - question about permanently mounting shares

Thu Aug 15, 2019 10:28 am

Perhaps using /home=sda1 & /opt=sda1 in your boot line, (remove opt & home from /opt/filetool.lst), will do what you want.

Fraoch
Posts: 90
Joined: Thu Mar 07, 2013 11:53 pm
Location: Cambridge, Ontario, Canada

Re: Really liking Tiny Core - question about permanently mounting shares

Thu Aug 15, 2019 1:44 pm

epoch1970 wrote:
Wed Aug 14, 2019 11:56 pm
Mhh. You do have the ability to archive your homedir, don’t you? (I don’t remember the name of the command)
In this case I think you home will be loop-mounted by the time fstab is read. So creating an empty directory in you home and then backing up your home would do the trick.
/home is backed up automatically. And if I back up with the share mounted in a /home directory, it attempts to back up everything on the share - even if I had the space, it crashes filetool.

I think you're right about fstab being read before I can create /home/[share] So it reads fstab, does not find the /home/[share] directory and skips it, then my startup script creates the mount point - too late.

It's like I need a shutdown script unmounting the share but keeping the mount point.
Pencoed-made Model 1B, Samsung memory
2B 1.1
3B+
4B 2GB

epoch1970
Posts: 3362
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Really liking Tiny Core - question about permanently mounting shares

Thu Aug 15, 2019 4:24 pm

FWIW my suggestion was to create a dir in /home, not mounting anything, backing up, and rebooting.
I believe unarchiving /home and loop mounts of all sorts happen as part of rootfs setup, hence before fstab is read and executed.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Fraoch
Posts: 90
Joined: Thu Mar 07, 2013 11:53 pm
Location: Cambridge, Ontario, Canada

Re: Really liking Tiny Core - question about permanently mounting shares

Thu Aug 15, 2019 4:45 pm

epoch1970 wrote: FWIW my suggestion was to create a dir in /home, not mounting anything, backing up, and rebooting.
I believe unarchiving /home and loop mounts of all sorts happen as part of rootfs setup, hence before fstab is read and executed.
The problem if I do that is it tries to back up /home/[mount] before it unmounts it - that crashes filetool. I need to unmount the share first then backup.
Pencoed-made Model 1B, Samsung memory
2B 1.1
3B+
4B 2GB

epoch1970
Posts: 3362
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Really liking Tiny Core - question about permanently mounting shares

Thu Aug 15, 2019 9:42 pm

Ah ok I think I’m starting to understand.
What about mounting to /mnt and adding a symlink from /home/mymount to /mnt?
IIRC the home archive is a tar file, I would expect the archival script will not dereference symlinks.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

Return to “Other”