Page 1 of 1
Finch and Mounting UFS
Posted: 12 Jun 2014 20:35
by justauser
I installed Finch last night, created a new jail, and installed a package on said jail. Worked great. Good stuff.
It was late, so I didn't have time to try mounting a filesystem within Finch, but that is my task tonight, and I just want to see if I have my steps correct.
I have four hard drives: HD1 (N4F installed here), HD2 (Finch, Jails and other random data), HD3 (data), HD4 (data).
HD2, HD3, and HD4 are all mounted within N4F in the mnt folder as HD2, HD3, and HD4 (I'm not very original with my names).
I am going to go into the N4F gui Disk Management Mount Points, find the disk partition names for HD2, HD3, HD4.
I will:
mkdir /mnt/HD2/finch/mnt/HD2
mkdir /mnt/HD2/finch/mnt/HD3
mkdir /mnt/HD2/finch/mnt/HD4
I will then go into Finch's fstab (/mnt/HD2/finch/etc/fstab) and add the disk partition names (made-up in the example below) for mounting:
/dev/HD2s1d /mnt/HD2/finch/mnt/HD2 ufs rw 0 0
/dev/HD3s1d /mnt/HD2/finch/mnt/HD3 ufs rw 0 0
/dev/HD4s1d /mnt/HD2/finch/mnt/HD4 ufs rw 0 0
Still in Finch's fstab, I will create nullfs links for the three drives back to N4F:
/mnt/HD2/finch/mnt/HD2 /mnt/HD2 nullfs rw 0 0
/mnt/HD2/finch/mnt/HD3 /mnt/HD3 nullfs rw 0 0
/mnt/HD2/finch/mnt/HD4 /mnt/HD4 nullfs rw 0 0
Save Finch's fstab.
In the N4F gui Disk Management Mount Points I will unmount and remove HD2, HD3, HD4.
Restart N4F.
Then for mounting the drives into a jail, I:
mkdir /mnt/HD2/finch/usr/jails/<jailname>/mnt/HD2
mkdir /mnt/HD2/finch/usr/jails/<jailname>/mnt/HD3
mkdir /mnt/HD2/finch/usr/jails/<jailname>/mnt/HD4
Edit the jail's fstab file at: /mnt/HD2/finch/usr/local/etc/qjail.fstab/<jailname> with
/mnt/HD2 /usr/jails/<jailname>/mnt/HD2 nullfs ro 0 0
/mnt/HD3 /usr/jails/<jailname>/mnt/HD3 nullfs ro 0 0
/mnt/HD4 /usr/jails/<jailname>/mnt/HD4 nullfs ro 0 0
I believe I have the steps correct. The one thing that worries me is the mounting of HD2, b/c the finch folder is on that drive, but I assume N4F boots -> loads Finch -> Finch reads its configuration files -> which mounts the drives -> then N4F continues on its way. Is that assumption correct?
Thanks for any input.
Re: Finch and Mounting UFS
Posted: 12 Jun 2014 21:57
by justauser
The more I think about it (especially having written it down), I do not believe the HD2 mounting will work. How could Finch run if its files are on a drive that n4f has not mounted?
Could I have n4f mount HD2, then have finch mount a folder in HD2, which would then get nullfs back to n4f?
Re: Finch and Mounting UFS
Posted: 16 Sep 2014 05:02
by SandiaSlice
I'm trying to mount a disk in finch and having issues I'm also using UFS volumes not ZFS pools. Did your process work for you (above)?
Re: Finch and Mounting UFS
Posted: 16 Sep 2014 10:54
by dreamcat4
justauser wrote:In the N4F gui Disk Management Mount Points I will unmount and remove HD2, HD3, HD4.
It sounds like it aught to work. The only other way I can think of is to have nas4free mount the UFS mount point inisde finch. And in fstab file just doing only the nullfs mounts (omtting the ones that nas4free can do for you). Which then becomes like ZFS ways.
The main thing to desire and try and aim for is to mount all your folders as early possible in the boot sequence. So then the folder is already mounted by the time things like SAMBA etc have started up, so it can read the folder and the files are mounted there.
Hmm. The only reason NAS4free GUI may be prefered is because it may execute a little earlier in the boot sequence than finch can do it (as all finch happens during postinit scripts time). But for you I'm not going to suggest that today because there may be an even better idea. We shall see if works or not.
What you may wish to try is to mount the finch fstab file earlier with a small a PREinit script (not postinit)... although I don't do it myself and have never tried this. The theory is that pre-init will mount earlier. Then when finch starts later on the mount -a command will do nothing - just verify that each fstab lines was already mounted. That ways everything can be mounted at the earliest opportunity during the boot.
Pinching the finch source code, we normally just mount -a the finch fstab file:
https://github.com/dreamcat4/finch/blob ... __boot#L48
We need to replace the $variable to substitute correctly since $finch_realpath will not declared in the nas4free pre-init boot environment:
mount -a -F "$(/usr/sbin/finch realpath)/etc/fstab"
Will run a subshell command to make the substitution. Otherwise, just use your full hardcoded path. Shown here at the command prompt:
Code: Select all
freenas ~/ id~$ echo mount -a -F "$(/usr/sbin/finch realpath)/etc/fstab"
mount -a -F /mnt/pool0/finch/etc/fstab
Just add that command as a PRE-init command or script.
And you should not need to change whatsoever the contents of the finch fstab file itself. (from what you already said previously).
Re: Finch and Mounting UFS
Posted: 28 Sep 2014 15:42
by SandiaSlice
Thank you for your suggestion. I did insert a pre-init script to mount the Finch fstab, and it seems to work just fine.
I now have Plex media server installed in a finch jail working fabulously. The only thing that I wish was preserved from prior to mounting my media drives inside finch (and this is truly a minor thing) is the ability to "see" my mounted drives in the nas4free GUI system info page. see attached pics:
N4F_status.jpg
N4F_status.jpg
N4F_mounts.jpg
Is there any way to allow nas4free to show stats on the drives mounted inside finch and then "mirrored" back to nas4free without breaking the Plex jail (which works fabulously ... did I say that yet)?
Sean
Re: Finch and Mounting UFS
Posted: 28 Oct 2014 06:36
by pepe_91
I still don't get how you can mount a file system into a point within the same file system. Can you explain how did you do it? i.e. what do you have in your fstab file(s), N4F config?
Right now I have two data disks and a N4F flash drive and finch is located in the first one. I managed to mount the second disk into finch and nullfs it to N4F but I have no idea how to mount the first disk so I can use it in a jail.
Also I haven't been able to make the nullfs command to work from the fstab (having it as a preinit command in N4F). Doing the command directly (mount_nullfs) does work though but fist I have to do a mkdir of the target mount point.
Re: Finch and Mounting UFS
Posted: 28 Oct 2014 18:55
by dreamcat4
To get your folders mounted inside of a jail, you need to edit that jail's fstab file. The proceedure is explained here:
http://dreamcat4.github.io/finch/mounti ... ems/#toc_7
As for why your nullfs command does not work in the fstab file. I can only guess that either you are trying to mount into a non-persistent filesystem (memfs) like a ramdisk. Or the other reason is the source folder or disk has not been mounted yet during boot sequence. A way of checking that is to try running "mount -a" after a fresh reboot and see if it succeeds / fails.
Re: Finch and Mounting UFS
Posted: 15 Nov 2014 21:31
by genes
Bump. I've got Finch installed and working fine. Even have most of my software installed already. However, I can't figure out UFS mounting to share the data in the jails.
My direct example:
Parents server. Only 1 Hard drive and it's UFS formatted. The Nas4free install is embedded usb so readonly.
Current mounts:
/mnt/1TB
Finch install location:
/mnt/1TB/data/finch
Name of jail: fileshare
Drive information: /dev/ada0p1 or /dev/ufsid/536e939240ea5984
Finch Fstab entries in /mnt/1TB/data/finch/etc/fstab:
#Mount main drive in finch
/dev/ada0p1 /mnt/1TB/data/finch/mnt/1TB ufs rw 0 0
#Nullfs link back to N4F
/mnt/1TB/data/finch/mnt/1TB /mnt/1TB nullfs rw 0 0
So that fstab doesn't work for me that way after removing n4f /mnt/1tb mount point and restarting. /mnt/1TB is never created. I'm also confused as to how I can mount the drive inside a folder structure that doesn't exist until the drive is mounted.
I'm perfectly fine putting everything in sharedfs. I tried mounting the directories i wanted individually (/mnt/1TB/Video /mnt/1TB/Downloads etc) there using preinit commands but they were empty after going into the jail... grr
I'm just lost at this point on how I'm supposed to fstab mount a drive/directory to a place that doesn't exist and then nullfs back to create it... any concrete examples of this or thoughts on what I can try? Any help would be appreciated as I can't seem to wrap my head around this
Edit:
Workaround but I'd still like to find the ideal way - postinit entry in nas4free for each directory I wish to have access to: mount -t nullfs /mnt/1TB/Video /mnt/1TB/data/finch/usr/jails/fileshare/mnt/Video
Re: Finch and Mounting UFS
Posted: 15 Nov 2014 23:01
by dreamcat4
genes wrote:
Drive information: /dev/ada0p1 or /dev/ufsid/536e939240ea5984
Finch Fstab entries in /mnt/1TB/data/finch/etc/fstab:
#Mount main drive in finch
/dev/ada0p1 /mnt/1TB/data/finch/mnt/1TB ufs rw 0 0
Perhaps in your case mounting the device from this file ^^ is wrong because that device would already need to have been mounted in order to see finch's fstab file. You already are / should be / need to be mounting your UFS drive in NAS4free confif.xml somehow. E.g. with a preinit command.
genes wrote:
#Nullfs link back to N4F
/mnt/1TB/data/finch/mnt/1TB /mnt/1TB nullfs rw 0 0
I'm sorry. It doesnt take much effort to see this is wrong also. Because you cannot mount over the same directories. And probably is not even permitted by freebsd's mount_nullfs cmd.
You could probably be doing something else a bit more like this:
/mnt/1TB/data/finch/mnt/1TB/Media /mnt/1TB/Media nullfs rw 0 0
or
/mnt/1TB/data/finch/mnt/1TB/data/Media /mnt/1TB/data/Media nullfs rw 0 0
where
Media/
Media/Video/
Media/Downloads/
Media/Music/
etc. etc.
genes wrote:
Edit:
Workaround but I'd still like to find the ideal way - postinit entry in nas4free for each directory I wish to have access to: mount -t nullfs /mnt/1TB/Video /mnt/1TB/data/finch/usr/jails/fileshare/mnt/Video
Yes, can may to that be inside a preinit command or preinit script. But you do need to make sure that your UFS drive is already mounted by nas4free before that point. e.g. your line:
mount /dev/ada0p1 /mnt/1TB/data/finch/mnt/1TB ufs rw 0 0
Should come first of all.
Again to re-iterate. By just mapping the 1 parent Media/ dir instead of seperate individual ones. Then you cut down how many individual mounts you need, as they will be in subfolders. So not quite as bad.
Kind Regards.