sudo fio --name=raid5-fulltest --filename=/mnt/data1/raid5-fulltest.dat --size=1T --rw=write --bs=1M --ioengine=libaio --iodepth=16 --direct=1 --verify=crc32c --do_verify=1 --verify_fatal=1
--group_reporting
raid5-fulltest: (g=0): rw=write, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=libaio, iodepth=16
fio-3.36
Starting 1 process
raid5-fulltest: Laying out IO file (1 file / 1048576MiB)
Jobs: 1 (f=1): V(1)r=462MiB/s[eta 00m:00s]
raid5-fulltest: (groupid=0, jobs=1): err= 0: pid=112216: Sat Aug 29 11:43:41 2026
read: IOPS=422, BW=423MiB/s (443MB/s)(1024GiB/2480016msec)

slat (usec): min=21, max=377, avg=117.01, stdev=48.52
clat (usec): min=990, max=1582.5k, avg=37519.93, stdev=17452.37
 lat (usec): min=1109, max=1582.6k, avg=37636.95, stdev=17449.37
clat percentiles (usec):
 |  1.00th=[  1647],  5.00th=[  5538], 10.00th=[ 10159], 20.00th=[ 20317],
 | 30.00th=[ 32637], 40.00th=[ 38011], 50.00th=[ 41157], 60.00th=[ 44303],
 | 70.00th=[ 47449], 80.00th=[ 50070], 90.00th=[ 54789], 95.00th=[ 60031],
 | 99.00th=[ 72877], 99.50th=[ 77071], 99.90th=[ 90702], 99.95th=[103285],
 | 99.99th=[130548]

write: IOPS=393, BW=394MiB/s (413MB/s)(1024GiB/2662917msec); 0 zone resets

slat (usec): min=1112, max=133084, avg=1441.15, stdev=897.17
clat (msec): min=4, max=523, avg=39.19, stdev=20.49
 lat (msec): min=5, max=525, avg=40.63, stdev=20.49
clat percentiles (msec):
 |  1.00th=[   22],  5.00th=[   22], 10.00th=[   22], 20.00th=[   29],
 | 30.00th=[   33], 40.00th=[   34], 50.00th=[   34], 60.00th=[   35],
 | 70.00th=[   36], 80.00th=[   37], 90.00th=[   78], 95.00th=[   85],
 | 99.00th=[  110], 99.50th=[  124], 99.90th=[  157], 99.95th=[  178],
 | 99.99th=[  347]

bw ( KiB/s): min=67584, max=488400, per=100.00%, avg=403623.43, stdev=37374.03, samples=5323
iops : min= 66, max= 476, avg=393.95, stdev=36.48, samples=5323
lat (usec) : 1000=0.01%
lat (msec) : 2=0.72%, 4=0.76%, 10=3.45%, 20=4.88%, 50=72.48%
lat (msec) : 100=16.89%, 250=0.80%, 500=0.01%, 750=0.01%, 1000=0.01%
lat (msec) : 2000=0.01%
cpu : usr=7.65%, sys=28.81%, ctx=1623599, majf=0, minf=28714
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=100.0%, 32=0.0%, >=64=0.0%

 submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
 complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
 issued rwts: total=1048576,1048576,0,0 short=0,0,0,0 dropped=0,0,0,0
 latency   : target=0, window=0, percentile=100.00%, depth=16

Run status group 0 (all jobs):
READ: bw=423MiB/s (443MB/s), 423MiB/s-423MiB/s (443MB/s-443MB/s), io=1024GiB (1100GB), run=2480016-2480016msec
WRITE: bw=394MiB/s (413MB/s), 394MiB/s-394MiB/s (413MB/s-413MB/s), io=1024GiB (1100GB), run=2662917-2662917msec

Disk stats (read/write):

dm-1: ios=1049368/1073697, sectors=2147434904/2152575728, merge=0/0, ticks=39320665/86615507, in_queue=125936172, util=100.00%, aggrios=2097970/1072835, aggsectors=2147490192/2152577800, aggrmerge=0/0, aggrticks=48587341/86399674, aggrin_queue=134987015, aggrutil=100.00%
md0: ios=2097970/1072835, sectors=2147490192/2152577800, merge=0/0, ticks=48587341/86399674, in_queue=134987015, util=100.00%, aggrios=680771/1068847, aggsectors=716205552/1076603685, aggrmerge=65488/133508975, aggrticks=15524340/23811662, aggrin_queue=39922929, aggrutil=98.21%

sdb: ios=660254/1068850, sectors=716205904/1076602589, merge=86134/133508836, ticks=30013862/28555098, in_queue=59408725, util=98.21%
sdc: ios=696999/1068809, sectors=716204568/1076604925, merge=49095/133509169, ticks=3364856/15028720, in_queue=18697322, util=77.29%
sda: ios=685062/1068883, sectors=716206186/1076603541, merge=61236/133508922, ticks=13194303/27851170, in_queue=41662740, util=95.26%
yangbo@appserver:~$


yangbo@appserver:~$ sudo fio --name=raid5-fulltest --filename=/mnt/data1/raid5-fulltest.dat --size=1T --rw=write --bs=1M --ioengine=libaio --iodepth=16 --direct=1 --verify=crc32c --do_verify=1 --verify_fatal=1
--group_reporting
raid5-fulltest: (g=0): rw=write, bs=(R) 1024KiB-1024KiB, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=libaio, iodepth=16
fio-3.36
Starting 1 process
raid5-fulltest: Laying out IO file (1 file / 1048576MiB)
Jobs: 1 (f=1): V(1)r=462MiB/s[eta 00m:00s]
raid5-fulltest: (groupid=0, jobs=1): err= 0: pid=112216: Sat Aug 29 11:43:41 2026
read: IOPS=422, BW=423MiB/s (443MB/s)(1024GiB/2480016msec)
slat (usec): min=21, max=377, avg=117.01, stdev=48.52
clat (usec): min=990, max=1582.5k, avg=37519.93, stdev=17452.37
lat (usec): min=1109, max=1582.6k, avg=37636.95, stdev=17449.37
clat percentiles (usec):
| 1.00th=[ 1647], 5.00th=[ 5538], 10.00th=[ 10159], 20.00th=[ 20317],
| 30.00th=[ 32637], 40.00th=[ 38011], 50.00th=[ 41157], 60.00th=[ 44303],
| 70.00th=[ 47449], 80.00th=[ 50070], 90.00th=[ 54789], 95.00th=[ 60031],
| 99.00th=[ 72877], 99.50th=[ 77071], 99.90th=[ 90702], 99.95th=[103285],
| 99.99th=[130548]
write: IOPS=393, BW=394MiB/s (413MB/s)(1024GiB/2662917msec); 0 zone resets
slat (usec): min=1112, max=133084, avg=1441.15, stdev=897.17
clat (msec): min=4, max=523, avg=39.19, stdev=20.49
lat (msec): min=5, max=525, avg=40.63, stdev=20.49
clat percentiles (msec):
| 1.00th=[ 22], 5.00th=[ 22], 10.00th=[ 22], 20.00th=[ 29],
| 30.00th=[ 33], 40.00th=[ 34], 50.00th=[ 34], 60.00th=[ 35],
| 70.00th=[ 36], 80.00th=[ 37], 90.00th=[ 78], 95.00th=[ 85],
| 99.00th=[ 110], 99.50th=[ 124], 99.90th=[ 157], 99.95th=[ 178],
| 99.99th=[ 347]
bw ( KiB/s): min=67584, max=488400, per=100.00%, avg=403623.43, stdev=37374.03, samples=5323
iops : min= 66, max= 476, avg=393.95, stdev=36.48, samples=5323
lat (usec) : 1000=0.01%
lat (msec) : 2=0.72%, 4=0.76%, 10=3.45%, 20=4.88%, 50=72.48%
lat (msec) : 100=16.89%, 250=0.80%, 500=0.01%, 750=0.01%, 1000=0.01%
lat (msec) : 2000=0.01%
cpu : usr=7.65%, sys=28.81%, ctx=1623599, majf=0, minf=28714
IO depths : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=100.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.1%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=1048576,1048576,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=16

Run status group 0 (all jobs):
READ: bw=423MiB/s (443MB/s), 423MiB/s-423MiB/s (443MB/s-443MB/s), io=1024GiB (1100GB), run=2480016-2480016msec
WRITE: bw=394MiB/s (413MB/s), 394MiB/s-394MiB/s (413MB/s-413MB/s), io=1024GiB (1100GB), run=2662917-2662917msec

Disk stats (read/write):
dm-1: ios=1049368/1073697, sectors=2147434904/2152575728, merge=0/0, ticks=39320665/86615507, in_queue=125936172, util=100.00%, aggrios=2097970/1072835, aggsectors=2147490192/2152577800, aggrmerge=0/0, aggrticks=48587341/86399674, aggrin_queue=134987015, aggrutil=100.00%
md0: ios=2097970/1072835, sectors=2147490192/2152577800, merge=0/0, ticks=48587341/86399674, in_queue=134987015, util=100.00%, aggrios=680771/1068847, aggsectors=716205552/1076603685, aggrmerge=65488/133508975, aggrticks=15524340/23811662, aggrin_queue=39922929, aggrutil=98.21%
sdb: ios=660254/1068850, sectors=716205904/1076602589, merge=86134/133508836, ticks=30013862/28555098, in_queue=59408725, util=98.21%
sdc: ios=696999/1068809, sectors=716204568/1076604925, merge=49095/133509169, ticks=3364856/15028720, in_queue=18697322, util=77.29%
sda: ios=685062/1068883, sectors=716206186/1076603541, merge=61236/133508922, ticks=13194303/27851170, in_queue=41662740, util=95.26%
yangbo@appserver:~$

sda sectors + sdb sectors + sdc sectors != md0

基本情况:

1.多互联网出口:内网拥有1条以上互联网出口(1条电信、1条连通)

项目需求:

  • 域名分别通过两个smartdns实例解析。smartdns_dx -> 电信上游 -> 结果写入ip4_dx; smartdns_lt -> 联通上游 -> 结果写入ip4_lt
  • nft根据目标IP是否匹配ip4_dx / ip4_lt来打标记(mark)。
  • ip route + route table 根据标记(mark)选择不同出口。
  • 动态切换时,通过脚本改写wan_policy_route 链内容
  • hook通过fw4 include持久化,避免fw4 reload后丢失。
  • 最优出局:联通Public DNS Server返回的IP从联通出口出局,电信Public DNS Server返回的IP从电信出口出局。
  • 故障切换:当联通线路故障不可用是,从电信接口出局;当电信接口不可用是,从联通接口出局。
  • 默认情况下,根据系统负载自由决定

- 阅读剩余部分 -

openwrt 23.x开始,dnsmasq-full不在支持ipset合集了。改为支持nftset了。原来还有为nftables安装iptables才能够对IP地址进行转发。改为nftset后可以直接和nftables配合使用。

1.创建nftset。在创建nftset合集是可以使用inet、ip、ip6等对IP地址合集进行定义,我这里使用inet。

nft add table inet iplistall
nft add set inet iplistall ip4list { type ipv4_addr ;}
nft add set inet iplistall ip6list { type ipv6_addr ;}

2.创建nftables规则,根据规则将nftset合集中的IP地址按照规则进行转发。

nft add chain inet iplistall output { type filter hook output priority 0 ; policy accept ; }
nft add chain inet iplistall prerouting { type nat hook prerouting priority dstnat ; policy accept ; }
nft add rule inet iplistall prerouting ip daddr @ip4list udp dport 0-65535 counter redirect to :1080
nft add rule inet iplistall prerouting ip daddr @ip4list tcp dport 0-65535 counter redirect to :1080



3.在dnsmasq中对相应的域名配置使用nftset。

nftset=/docker.com/4#inet#iplistall#ip4list
nftset=/docker.com/6#inet#iplistall#ip6list

4.相关命令
a.查看所有tables。nft list tables
b.查看nftset 地址合集 。 nft list set inet iplistall ip4list
c.查看nft规则列表。 nft list ruleset

5.参考资源
a.https://nie11kun.github.io/archives/dnsmasq-nftset-nftables-1.html https://github.com/v2fly/domain-list-community/blob/master/data/netflix
b.chatgpt
c.doubao

参考页面信息:https://openwrt.org/docs/guide-user/virtualization/vmware?s%5B%5D=esxi

在Linux下调整img文件的分区大小

1.准备工作

本操作需要用到qemu-img fdisk e2fsck resize2fs等工具,在ubuntu系统中,可以用下列命令安装

sudo apt-get install -y qemu-utils parted e2fsprogs

2.获取img文件

http://www.openwrt.org

3.扩展img文件大小

使用qemu-img工具扩展openwrt的img文件大小。本次扩展到1GB。

qemu-img resize -f raw 2openwrt.img 1G

4.调整img文件分区大小

  • 使用losetup将img文件挂载为环回设备:

    sudo losetup -fP ./2openwrt.img
    sudo losetup -a
    /dev/loop9: [64768]:6561801 (/home/user/openwrt-24.10/2openwrt.img)
  • 查看当前img文件的分区信息

    sudo parted /dev/loop9 unit s print
    Model: Loopback device (loopback)
    Disk /dev/loop9: 2097152s
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    Disk Flags: 
    
    Number  Start   End      Size     Type     File system  Flags
     1      512s    33279s   32768s   primary  ext2         boot
     2      33792s  246783s  212992s  primary  ext4
    
  • 用parted调整分区大小,不要删除分区,直接resizepart分区大小,不然如果你用的是EFI安装包的话,删除了分区后分区的uuid会发生变化。

    parted /dev/loop9
    print free
    resizepart 1GB
  • 同步分区信息

    sudo partx -u /dev/loop9

5.扩展新的root分区大小

  • 使用e2fsck 和 resize2fs 扩展新的root分区。

    sudo e2fsck -f /dev/loop9p2
    sudo resize2fs  /dev/loop9p2
    
    yangbo@homeserver2:~/openwrt-24.10$ sudo e2fsck -f /dev/loop9p2
    e2fsck 1.45.5 (07-Jan-2020)
    Pass 1: Checking inodes, blocks, and sizes
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    Padding at end of inode bitmap is not set. Fix<y>? yes
    
    rootfs: ***** FILE SYSTEM WAS MODIFIED *****
    rootfs: 1573/6656 files (0.0% non-contiguous), 7887/32768 blocks
    yangbo@homeserver2:~/openwrt-24.10$ 
    yangbo@homeserver2:~/openwrt-24.10$ sudo resize2fs  /dev/loop9p2
    resize2fs 1.45.5 (07-Jan-2020)
    Resizing the filesystem on /dev/loop9p2 to 257920 (4k) blocks.
    The filesystem on /dev/loop9p2 is now 257920 (4k) blocks long.
    
    yangbo@homeserver2:~/openwrt-24.10$ 

将img文件转换为VMDK文件

openwrt的img文件不论是直接下载的还是扩容后的,都不能直接用于VMware ESXi。需要将其转换为vmware 的vmdk文件。使用qemu-img文件,命令如下

qemu-img convert -f raw -O vmdk 2openwrt.img 2openwrt.vmdk

在ESXi中创建虚拟机并使用扩容后的VMDK文件

这个就不写了,无非不过上传VMDK文件,创建虚拟机,使用已存在的虚拟硬盘即可。

问题

如果partuudi发生了变化,1.可以查看新的partuuid,然后修改boot分区grub.cfg文件的内容。2.重新操作,注意不要让partuuid发生变化。