Changing Ls Colors on NAS4Free

There is one thing I hate on my NAS4Free server - dark blue color when listing directories using ls command. It is simply an awful choice.

From Linux I knew about LS_COLORS variable and its configuration. However, NAS4Free is not Linux. And while similarities are plentiful, some things are simply not working the same.

Fortunately, one can always consult man page and see FreeBSD uses LSCOLORS variable with wildly different configuration. Curious can look at full configuration but suffice to say I was happy with just changing directory entry from blue (e) to bright blue (E).

To do this in my .bashrc I added:

export LSCOLORS="^^E^^xfxcxdxbxegedabagacad"

PS: How to preserve .bashrc over reboots is exercise left to reader because it depends on your system. Suffice to say is that either ZFS mount point or simply appending in postinit script work equally well.

[2018-07-22: NAS4Free has been renamed to XigmaNAS as of July 2018]

Determining Windows 10 ISO Build

Illustration

Windows 10 releases are numerous. If you are using Microsoft Media Creation Tool to download ISOs, you know how hard is to track them. Fortunately, it is possible to get information about version from ISO file itself.

First order of business is mounting downloaded ISO file. It is as easy as double clicking on it.

Then find Setup.exe; right-click; Properties; and go to Details tab. There under product version you will find the build number - in my case it was 15063.

If you want to know more (e.g. which editions are present in .iso file) we need to open Administrator command prompt (or PowerShell) and run [dism](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/what-is-dism). I will assume, ISO is mounted as disk W: and that your download includes both 32-bit and 64-bit Windows. Adjust path to install.wim as needed.

dism /Get-WimInfo /WimFile:W:\x64\sources\install.esd
 Deployment Image Servicing and Management tool
 Version: 10.0.15063.0
 Details for image : W:\x64\sources\install.esd
 Index : 1
 Name : Windows 10 Pro
 Description : Windows 10 Pro
 Size : 15,305,539,033 bytes
 Index : 2
 Name : Windows 10 Home
 Description : Windows 10 Home
 Size : 15,127,824,725 bytes
 Index : 3
 Name : Windows 10 Home Single Language
 Description : Windows 10 Home Single Language
 Size : 15,129,601,869 bytes
 Index : 4
 Name : Windows 10 Education
 Description : Windows 10 Education
 Size : 15,125,050,322 bytes
 The operation completed successfully.

As you can see, this disk consists of four editions. Which one gets installed is determined based on your product key.

And you can go even further with investigation, if you give it index parameter:

dism /Get-WimInfo /WimFile:^^W:\x64\sources\install.esd^^ /index:^^1^^
 Deployment Image Servicing and Management tool
 Version: 10.0.15063.0
 Details for image : W:\x64\sources\install.esd
 Index : 1
 Name : Windows 10 Pro
 Description : Windows 10 Pro
 Size : 15,305,539,033 bytes
 WIM Bootable : No
 Architecture : x64
 Hal : 
 Version : 10.0.15063
 ServicePack Build : 0
 ServicePack Level : 0
 Edition : Professional
 Installation : Client
 ProductType : WinNT
 ProductSuite : Terminal Server
 System Root : WINDOWS
 Directories : 19668
 Files : 101896
 Created : 2017-03-18 - 19:40:43
 Modified : 2017-08-26 - 21:33:30
 Languages :
         en-US (Default)
 The operation completed successfully.

My Dashcam Video Encoding Settings

Illustration

I love dashcam footage from vacation. Not only I get photos of various places I’ve visited but also route I used to get to them. And there are some beautiful drives out there.

My Garmin DriveAssist 50 outputs full HD baseline MP4 videos with constant bitrate that is slightly higher than 8 Mbps. As with all dashcam videos, the quality is not something to get excited about but it isn’t too bad either. My standard process is simply to re-cut these videos to throw out idle time (e.g. while parked). Since I don’t really use them for further editing, compression settings are a bit on aggressive side.

I start by customizing Internet HD 1080p profile as it has most of configuration as I want it. What I do change is Profile level by simply increasing it to High. I consume there videos on my PC and there is simply no reason I could think of to go lower. And yes, High profile works on mobile phone too.

Dashcam videos lend themselves quite well to MP4 compression so I went with average variable rate of 6 Mbps. For moments when a bit more action is happening, a maximum of 8 Mbps should suffice. Note that I use two-pass encoding here in order to squeeze a bit more quality despite lower bitrate. This does double the encoding time but I find it reasonable compromise.

I also uncheck progressive download support as I don’t intend to stream these and this does give a few more bits to encoder.

Lastly, as my camera doesn’t record sound, I turn the audio off.

Express 2017 for Windows Desktop

Illustration

Moment I’ve been waiting for since Visual Studio 2017 was released is finally (almost) here.

While Community edition is more capable, restrictions on its use within anything but the smallest (or opensource) companies are quite limiting. Whereas developers can (hopefully) get at least Professional or even Enterprise edition, the same cannot be said for people who might need access to code just occasionally or who enjoy making small internal tools. For them Express used to be god-given due to its quite permissive licence.

Preview version does have license restrictions on production use, but my expectation is that final version will have the same licence as 2015.

Sysadmins, rejoice!

[2017-10-17: Final release of Visual Studio Express 2017 is out.]

Custom Samba Sizing

After reorganizing my ZFS datasets a bit, I suddenly noted I couldn’t copy any file larger than a few MB. A bit of investigation later and I figured why it was so.

My ZFS data sets were as follows:

zfs list
 NAME                            USED  AVAIL  REFER  MOUNTPOINT
 Data                           2.06T   965G    96K  none
 Data/Users                      181G   965G    96K  none
 Data/Users/User1               44.3G  19.7G  2.23G  /Data/Users/User1
 Data/Users/User2               14.7G  49.3G   264K  /Data/Users/User2
 Data/Users/User3                224K  64.0G    96K  /Data/Users/User3

And my Samba share was pointing to /Data/Users/.

Guess what? Path /Data/Users was not pointing to any dataset as my parent dataset for Data/Users was not mounted. Instead it pointed to memory disk md0 which had just a few MB free. Samba doesn’t check full path for disk size but only its root share.

The easiest way to workaround this would be to simply mount parent dataset. But why go for easy?

A bit more complicated solution is getting Samba to use custom script to determine free space. We can then use this script to return available disk space for our parent dataset instead of built-in samba calculation.

To do this, we first create script /myScripts/sambaDiskFree:

#!/bin/sh
DATASET=`pwd | cut -c2-`
zfs list -H -p -o available,used $DATASET | awk '{print $1+$2 " " $1}'

This script will check current directory, map its name to dataset (in my case it is as easy as stripping first slash character) and return two numbers. First is total disk space, followed by available diskspace - both in bytes.

Once script is saved and marked as executable (chmod +x), we just need to reference it in Services > CIFS/SMB > Settings under Additional parameters:

dfree command = /myScripts/sambaDiskFree

This will tell Samba to use our script for disk space determinations.