This is an old revision of the document!
Table of Contents
Nas4Free Build
Partition drives for ZFS
VirtualBox
cd /mnt/storage
mkdir VirtualBox
cd VirtualVBox
For different version visit https://e-vectra.ru/index.php/s/TFbpcHxi7jTcIPe?path=%2FNAS4Free-VirtualBox and drop into /mnt/storage/VirtualBox
tar xf vbox_installerxxxxxxxxxxxxxx
chmod +x vbox_configure.sh
./vbox_configure.sh
ZFS Tune
mkdir /mnt/data/zfskerntune cd /mnt/data/zfskerntune fetch http://www.peach.ne.jp/archives/nas4free/ext/zfskerntune-20121031.tar.gz tar xvf zfskerntune-20121031.tar.gz cd zfskerntune ./zfskerntune-install.php
TheBrig
http://www.forums.nas4free.org/viewtopic.php?t=3894
fetch -o /tmp/thebrig_install.sh https://github.com/fsbruva/thebrig/raw/working/thebrig_install.sh
chmod a+x /tmp/thebrig_install.sh
/bin/sh /tmp/thebrig_install.sh /mnt/NAS-A/Jail 2
note: change /mnt/NAS-A/Jail by your own destination, if your pool is named Data, can be /mnt/Data/Jail
Edit hosts file
vi /etc/hosts
edit line with IP address 127.0.0.1 to read
127.0.0.1 – localhost.{your jail name}.local
add line at bottom with your jail IP and your jail name (My line reads: 192.168.1.200 emon.local)
{your jail IP address} {your jail name}.local
Save and exit
4K sectors
For each device which will be made a part of the pool, a gnop “chained” device needs to be created, and then those devices need to be added to a pool:
gnop create -S 4096 /dev/da0 gnop create -S 4096 /dev/da1 zpool create data mirror /dev/da0.nop /dev/da1.nop
This will create the “data” pool with the *.nop devices, making ZFS think the drives have 4K physical sectors. Next, the pool needs to be exported and the gnop devices removed:
zpool export data gnop destroy /dev/da0.nop /dev/da1.nop
Next, the pool can be imported from the “raw” devices:
zpool import data
You can check the configuration of the pool by using the “zdb” command on the pool:
zdb -C data | grep ashift
The ashift should be “12” for 4K alignment. This works because ZFS writes the ashift value in its metadata.
Plex
Next, to download the ports tree (this includes the files to compile Plex), run the following:
portsnap fetch portsnap extract
Now, to install Plex, run the following command:
cd /usr/ports/multimedia/plexmediaserver/ && make install clean
Once that is complete, you need to setup Plex to start automatically when the jail starts with the following command:
echo plexmediaserver_enable="YES" >> /etc/rc.conf
Next, start Plex with the following:
service plexmediaserver start
Upgrading Plex
When new releases of Plex come out, you may update without losing your data and preferences. To check if a new release of Plex is available via ports, visit this page:
http://www.freshports.org/multimedia/plexmediaserver/
To upgrade Plex, first install a tool called portupgrade with this command:
cd /usr/ports/ports-mgmt/portupgrade/ && make install clean
When configuration dialog boxes appear, accept the defaults.
Next, you have to update the FreeBSD port tree with this command:
portsnap fetch update
Then to upgrade all ports at once, use the following:
portupgrade -a
Alternatively, you can have portupgrade prompt you before upgrading each port with this:
portupgrade -ai
or
In short, for upgrade just go to where you had installed plex (chroot, jail, jail in chroot...) and upgrade SW pkg upgrade
Afterwards, your ports, including Plex, should be up to date.
Upgrade Plex
I run the commands as root, so su preceding the following or log into the jail as root.
mkdir /tmp/src cd /tmp/src wget http://downloads.ple...d-amd64.tar.bz2 tar xvf PlexMediaServer-0.9.9.12.504-3e7f93c-freebsd-amd64.tar.bz2 service plexmediaserver stop mv /usr/local/share/plexmediaserver /usr/local/share/oldplex mkdir /usr/local/share/plexmediaserver cp -r /tmp/PlexMediaServer-0.9.12.4.1192-9a47d21/* /usr/local/share/plexmediaserver/ service plexmediaserver start
Of course after it starts and you verify it runs properly you can remove the old folders and the tar/extracted copies. Now you are on the latest build with out having to wait for the plugin to be updated.
This will only update the actual plex media server and leave all the media database and meta data alone since it is segmented into it's own folders. Once you start the server go into settings and server info, you may need to force it to refresh the page but will list 9.9.12 as the version.
