西维蜀黍

【TrueNAS】读写性能测试

可以测试

  • 物理 disk 的读写速度
  • ZFS 的读写速度(内存会作为ARC,因此内存越大,自然速度越快)
    • 在 TrueNAS 主机上进行测试
    • 在 client端 进行测试(会被ARC和网络影响)

Disk

  • 海康威视 C2000Pro 2TB
    • 官方标速:最大顺序读 3400MB/S,最大顺序写 3100MB/S

diskinfo

$ diskinfo -tv nvd0
...
Transfer rates:
	outside:       102400 kbytes in   0.037547 sec =  2727249 kbytes/sec
	middle:        102400 kbytes in   0.036066 sec =  2839239 kbytes/sec
	inside:        102400 kbytes in   0.097002 sec =  1055648 kbytes/sec

$ diskinfo -tv nvd0
...
Transfer rates:
	outside:       102400 kbytes in   0.037414 sec =  2736943 kbytes/sec
	middle:        102400 kbytes in   0.035900 sec =  2852368 kbytes/sec
	inside:        102400 kbytes in   0.212731 sec =   481359 kbytes/sec

SSD

  • 2.73GB/s

dd

SSD

Read

海康威视 SSD

# 1GB, block 1KB
$ dd if=/dev/nvd0 of=speed_test_temp_file bs=1024 count=1000000
1000000+0 records in
1000000+0 records out
1024000000 bytes transferred in 12.824254 secs (79848702 bytes/sec)

# 1GB, block 1MB
$ dd if=/dev/nvd0 of=speed_test_temp_file bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 0.705722 secs (1485820772 bytes/sec)
$ dd if=/dev/nvd0 of=speed_test_temp_file bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 0.657703 secs (1594300718 bytes/sec)
$ dd if=/dev/nvd0 of=speed_test_temp_file bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 0.660621 secs (1587257485 bytes/sec)
$ dd if=/dev/nvd0 of=speed_test_temp_file bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes transferred in 0.662474 secs (1582817905 bytes/sec)

# 10GB, block 1MB
➜  ~ dd if=/dev/nvd0 of=speed_test_temp_file bs=1M count=10000
10000+0 records in
10000+0 records out
10485760000 bytes transferred in 26.722108 secs (392400185 bytes/sec)
➜  ~ dd if=/dev/nvd0 of=speed_test_temp_file bs=1M count=10000
10000+0 records in
10000+0 records out
10485760000 bytes transferred in 29.718711 secs (352833610 bytes/sec)
➜  ~ dd if=/dev/nvd0 of=speed_test_temp_file bs=1M count=10000
10000+0 records in
10000+0 records out
10485760000 bytes transferred in 31.348440 secs (334,490,644 bytes/sec)
  ...


【Linux】命令 - dd

dd Command

dd is a command-line utility for Unix and Unix-like operating systems, the primary purpose of which is to convert and copy files.

On Unix, device drivers for hardware (such as hard disk drives) and special device files (such as /dev/zero and /dev/random) appear in the file system just like normal files; dd can also read and/or write from/to these files, provided that function is implemented in their respective driver.

As a result, dd can be used for tasks such as backing up the boot sector of a hard drive, and obtaining a fixed amount of random data.

  ...


【FreeBSD】显示磁盘信息

geom - List Disks

# List all disks
$ geom disk list

# List a specific disk
$ diskinfo -v nvd0
nvd0
	512         	# sectorsize
	2048408248320	# mediasize in bytes (1.9T)
	4000797360  	# mediasize in sectors
	0           	# stripesize
	0           	# stripeoffset
	HS-SSD-C2000Pro 2048G	# Disk descr.
	30027331913 	# Disk ident.
	Yes         	# TRIM/UNMAP support
	0           	# Rotation rate in RPM
	
$ diskinfo -v ada1
ada1
	512         	# sectorsize
	6001175126016	# mediasize in bytes (5.5T)
	11721045168 	# mediasize in sectors
	4096        	# stripesize
	0           	# stripeoffset
	11628021    	# Cylinders according to firmware.
	16          	# Heads according to firmware.
	63          	# Sectors according to firmware.
	WDC WD60EFRX-68L0BN1	# Disk descr.
	WD-WX32D404LT1P	# Disk ident.
	id1,enc@n3061686369656d30/type@0/slot@2/elmdesc@Slot_01	# Physical path
	No          	# TRIM/UNMAP support
	5700        	# Rotation rate in RPM
	Not_Zoned   	# Zone Mode
  ...


【FreeBSD】磁盘速度测试

geom - List Disks

# List all disks
$ geom disk list

# List a specific disk
$ geom disk list ada5
$ geom disk list ada2
  ...


【FreeBSD】搭建DHCP服务器

  ...


【Hackintosh】macOS 下制作 OpenCore 引导 U 盘

制作 OpenCore 引导 U 盘

Setting up the installer

Now we’ll be formatting the USB to prep for OpenCore. We’ll want to use macOS Extended (HFS+) with a GUID partition map. This will create two partitions: the main MyVolume and a second called EFI which is used as a boot partition where your firmware will check for boot files.

  • Note: By default, Disk Utility only shows partitions – press Cmd/Win+2 to show all devices (alternatively you can press the View button)

  ...


【macOS】Alfred 效率

快捷键

  ...


【TrueNAS】使用 Node Exporter(Grafana)监控 TrueNAS

Situation

我们都知道,如果你知道在 TrueNAS OS 中通过 pkg 来安装软件,会得到下面的错误:

$ pkg install git
Updating local repository catalogue...
pkg: file:///usr/ports/packages/meta.txz: No such file or directory
repository local has no meta file, using default settings
pkg: file:///usr/ports/packages/packagesite.txz: No such file or directory
Unable to update repository local
Error updating repositories!

事实上,官方 doc 中有明确说到:我们不应该在 TrueNAS OS 中安装你想安装的软件,而是把这些软件安装在 Jail 里面。

问题来了,如果我想使用 Node Exporter 监控 TrueNAS 宿主机。

(实在是看不习惯 TrueNAS 自带的监控)

那么如果我把 Node Exporter 安装在 Jail instance里面,那么自然监控的是 Jail 本身,而不是 TrueNAS 宿主机。

  ...


【Linux】Shell - 判断当前操作系统

#!/usr/bin/env bash

if [ "$(uname)" == "Darwin" ]; then
    # Do something under Mac OS X platform        
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
    # Do something under GNU/Linux platform
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
    # Do something under 32 bits Windows NT platform
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then
    # Do something under 64 bits Windows NT platform
fi
  ...


【Ubuntu】连接SMB

for Test

$ sudo apt install smbclient
$ smbclient -L //myServerIpAdress
  ...