Time for TrueNAS resource on command line Unix?

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
We get a few users requesting help with command line Unix. They probably came from the MS-Windows world, though some could be Mac users. Overall, they want to know what they can do from a TrueNAS command line. (And we should probably let them know what they CAN'T do from the command line.) I am referring to direct shell, not the iXsystems' CLI.

So, anyone want to add to this effort?

Whence we have enough information, we can create a resource to point new users who have Unix command line question. I will edit this main post a bit as suggestions come in, (if any...).

----
Introduction to Unix command line for TrueNAS Core & TrueNAS SCALE

Not all Unix management will be included here. This is more related to what could be useful for a NAS device.

Please note that changing a configuration file outside of TrueNAS Core, (or SCALE), control, will likely not survive a reboot. And even if it does, it may not survive an update. Make all changes in the GUI or the TrueNAS supplied CLI. If the feature does not exist in the GUI or CLI, and is of general purpose nature, you can always submit a feature request in Jira.

The below commands do not make any changes, just display information:
zpool status zpool list zfs list zfs get all df -h uname -a ifconfig -a netstat -an smartctl -x /dev/DISK - Replace "DISK" with the disk you want SMART information from.
top - Use "q" to quit
exit - To exit a shell session

TrueNAS Core, (aka FreeBSD specific items):
zdb -U /data/zfs/zpool.cache | grep ashift # Get the ashift / block size used by ZFS for a pool
freebsd-version

TrueNAS SCALE, (aka Linux specific items):
zpool get ashift YOUR_POOL_NAME # Get the ashift / block size used by ZFS for a pool
hdparm -I /dev/DISK - Replace "DISK" with the disk you want the information from
 
Last edited:
Joined
Jan 4, 2014
Messages
1,644
@Arwen I think this is a really good idea. A couple of things to consider:
  • There's a thread with Useful Commands that's worth tapping into.
  • As @Patrick M. Hausen points out in this post, encouraging and guiding new users in the use of PuTTY and WinSCP rather than the UI Shell is long overdue. Whether it be part of the brief for the resource you're considering, or a separate resource, I'm not sure?
  • Should the proposed resource cover iocage commands for jails as well e.g. iocage list? iocage wasn't around when the Useful Commands thread was created.
 
Last edited:

Arwen

MVP
Joined
May 17, 2014
Messages
3,611
@Basil Hendroff, thank you. I'm reviewing the links you posted. And yes, I think a section on the use of SSH clients, like PuTTY, etc... is both appropriate and something useful for this doc.

I've started adding to the command list. See the first post's command list.

At present i don't have access to FreeBSD or TrueNAS Core, (just the Linux TrueNAS SCALE), so I don't know if this one is still needed;

zdb -C YOUR_POOL_NAME | grep ashift #shows the ashift value

Or if the this will work on TrueNAS Core, (as it does with Linux & SCALE);

zpool get ashift YOUR_POOL_NAME #shows the ashift value

Any other suggestions?
 
Joined
Jan 4, 2014
Messages
1,644
Or if the this will work on TrueNAS Core, (as it does with Linux & SCALE);

zpool get ashift YOUR_POOL_NAME #shows the ashift value
While the command runs, it doesn't display the correct result.
Code:
root@truenas-t[/]# zpool get ashift tank
NAME  PROPERTY  VALUE   SOURCE
tank  ashift    0       default

so I don't know if this one is still needed;
zdb -C YOUR_POOL_NAME | grep ashift #shows the ashift value
This had to be modified to work.
Code:
root@truenas-t[/]# zdb -U /data/zfs/zpool.cache | grep ashift
            ashift: 12

Any other suggestions?
Code:
root@truenas-t[/]# freebsd-version
12.2-RELEASE-p6
 

Constantin

Vampire Pig
Joined
May 19, 2017
Messages
1,829
Conversely, it would be AWESOME if iXsystems could get the shell in the UI to behave as expected, vs. the way it does today.
 
Joined
Jan 4, 2014
Messages
1,644
Top