AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-11805

gcb's questions

Martin Hope
gcb
Asked: 2025-02-07 00:50:17 +0800 CST

我应该在 LUKS 中使用物理还是逻辑扇区大小?

  • 6

我有一个外部硬盘 (不是固态硬盘),它报告:

Sector Sizes:     512 bytes logical, 4096 bytes physical

我应该使用 --sector-size 512还是 --sector-size 4096使用cryptosetup LuksFormat?使用默认参数(不确定它是否会尝试自动检测或始终使用 512)最终得到 512。

如果重要的话,设置将是[disk]->[gpt]->[physical partition]->[LUKSv2]->[btrfs]


继续使用这两种方式来收集基准:

512

# sysbench fileio prepare
2147483648 bytes written in 34.28 seconds (59.75 MiB/sec).

# sysbench fileio --file-test-mode=rndrw run
Extra file open flags: (none)
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Number of IO requests: 0
Read/Write ratio for combined random IO test: 1.50
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing random r/w test
Initializing worker threads...

Threads started!


File operations:
    reads/s:                      14.42
    writes/s:                     9.62
    fsyncs/s:                     31.25

Throughput:
    read, MiB/s:                  0.23
    written, MiB/s:               0.15

General statistics:
    total time:                          12.4778s
    total number of events:              562

Latency (ms):
         min:                                    0.00
         avg:                                   17.84
         max:                                  365.73
         95th percentile:                       84.47
         sum:                                10024.98

Threads fairness:
    events (avg/stddev):           562.0000/0.00
    execution time (avg/stddev):   10.0250/0.00


# sysbench fileio --file-test-mode=seqrewr run
Extra file open flags: (none)
128 files, 16MiB each
2GiB total file size
Block size 16KiB
Periodic FSYNC enabled, calling fsync() each 100 requests.
Calling fsync() at the end of test, Enabled.
Using synchronous I/O mode
Doing sequential rewrite test
Initializing worker threads...

Threads started!


File operations:
    reads/s:                      0.00
    writes/s:                     815.93
    fsyncs/s:                     1045.19

Throughput:
    read, MiB/s:                  0.00
    written, MiB/s:               12.75

General statistics:
    total time:                          10.0488s
    total number of events:              18576

Latency (ms):
         min:                                    0.00
         avg:                                    0.54
         max:                                  433.66
         95th percentile:                        0.02
         sum:                                 9996.57

Threads fairness:
    events (avg/stddev):           18576.0000/0.00
    execution time (avg/stddev):   9.9966/0.00

4096年

# sysbench fileio prepare
2147483648 bytes written in 28.85 seconds (70.99 MiB/sec).


# sysbench --test=fileio --file-test-mode=rndrw run
File operations:
    reads/s:                      26.17
    writes/s:                     17.45
    fsyncs/s:                     58.35

Throughput:
    read, MiB/s:                  0.41
    written, MiB/s:               0.27

General statistics:
    total time:                          11.4636s
    total number of events:              1041

Latency (ms):
         min:                                    0.00
         avg:                                    9.63
         max:                                  370.49
         95th percentile:                       44.98
         sum:                                10021.97

Threads fairness:
    events (avg/stddev):           1041.0000/0.00
    execution time (avg/stddev):   10.0220/0.00



# sysbench fileio --file-test-mode=seqrewr run
File operations:
    reads/s:                      0.00
    writes/s:                     1229.02
    fsyncs/s:                     1574.44

Throughput:
    read, MiB/s:                  0.00
    written, MiB/s:               19.20

General statistics:
    total time:                          10.0071s
    total number of events:              27929

Latency (ms):
         min:                                    0.00
         avg:                                    0.36
         max:                                  471.49
         95th percentile:                        0.02
         sum:                                 9997.75

Threads fairness:
    events (avg/stddev):           27929.0000/0.00
    execution time (avg/stddev):   9.9978/0.00

对于人工小文件,4K 的读取速度似乎快两倍,写入速度快 0.25 倍。


另一次编辑。进行了同样的测试,但复制了 110G 的文件包,大小从 2.5Mb(95%tile)到 300Mb 不等。

512 和 4096 格式化驱动器均耗时 20 分 30 秒 +-4 秒

filesystems
  • 1 个回答
  • 41 Views
Martin Hope
gcb
Asked: 2024-10-04 06:28:49 +0800 CST

我是否应该关心 ext4 空闲块/inode/孤立块计数是否错误?

  • 7

我让系统在每次重启时都对所有文件系统进行 fsck。现在又强制进行了 fsck。但我仍然得到:

$ sudo fsck -vn /dev/lvmroot/root 
fsck from util-linux 2.40.2
e2fsck 1.47.1 (20-May-2024)
Warning!  /dev/mapper/lvm/root is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
root has been mounted 1 times without being checked, check forced.
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
Free blocks count wrong (12783960, counted=12783944).
Fix? no

Free inodes count wrong (5263640, counted=5263625).
Fix? no

Feature orphan_present is set but orphan file is clean.
Clear? no
      503528 inodes used (8.73%, out of 5767168)
         271 non-contiguous files (0.1%)
         237 non-contiguous directories (0.0%)
             # of inodes with ind/dind/tind blocks: 0/0/0
             Extent depth histogram: 448994/96
    10284712 blocks used (44.58%, out of 23068672)
           0 bad blocks
           5 large files

      409720 regular files
       37767 directories
           0 character device files
           0 block device files
           0 fifos
        4248 links
       56022 symbolic links (54421 fast symbolic links)
          24 sockets
------------
      507781 files

我是否应该特意去修复它?

ext4
  • 1 个回答
  • 30 Views
Martin Hope
gcb
Asked: 2024-08-03 00:14:37 +0800 CST

什么原因可能导致 ls 忽略 setgid (sg, g+s) 目录的 LS_COLORS?

  • 8

尝试以不同的颜色显示 setgid 但失败。

尝试了最低限度: LS_COLORS="sg:41;41" ls -la --color=auto但仍然得到了 setgid( chmod g+s) 目录的常规目录颜色。

然后尝试使用dircolors,首先使用输出“模板” dircolors -p > ~/.dircolors,仅编辑setgid行,然后eval $(dircolors -b ~/.dircolors)

# ~/.dircolors
…
SETGID 30;44 # file that is setgid (g+s)                                                                                                                              
…

它产生:

env | grep LS_
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;44:ca=00:tw=30;42:ow=30;44;01:st=30;44;01:ex=01;32:*.7z=01;31:*.ace=01;31:*.alz=01;31:*.apk=01;31:*.arc=01;31:*.arj=01;31:*.bz=01;31:*.bz2=01;31:*.cab=01;31:*.cpio=01;31:*.crate=01;31:*.deb=01;31:*.drpm=01;31:*.dwm=01;31:*.dz=01;31:*.ear=01;31:*.egg=01;31:*.esd=01;31:*.gz=01;31:*.jar=01;31:*.lha=01;31:*.lrz=01;31:*.lz=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.lzo=01;31:*.pyz=01;31:*.rar=01;31:*.rpm=01;31:*.rz=01;31:*.sar=01;31:*.swm=01;31:*.t7z=01;31:*.tar=01;31:*.taz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tgz=01;31:*.tlz=01;31:*.txz=01;31:*.tz=01;31:*.tzo=01;31:*.tzst=01;31:*.udeb=01;31:*.war=01;31:*.whl=01;31:*.wim=01;31:*.xz=01;31:*.z=01;31:*.zip=01;31:*.zoo=01;31:*.zst=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:

尝试了更明显的颜色41;41(红色加红色),但没有效果。

它对于文件来说工作得很好,但对于目录来说却不行。

这里有一些截图。D1是一个带有 setgid 的目录。

ls 没有显示 g+s 的颜色

与树相同,只是为了确保这不是孤立的东西ls g+s 的树不显示颜色

在上述测试中我su也使用了,因为和su都是sg其他 shell 上不可用的 gnu bash 扩展。

$ bash --version
GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

$ ls --version
ls (GNU coreutils) 9.5
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.

ls
  • 2 个回答
  • 97 Views
Martin Hope
gcb
Asked: 2024-04-04 01:49:54 +0800 CST

如何使自动完成的 systemd 单元名称不区分大小写?

  • 6

Bash 自动完成功能对 systemd 单元名称的类似 php 命名约定有很大帮助。彻底解决了Kebab-case、snake_case、camelCase的混合问题。

但我仍然对诸如第一个字母的大小写错误之类的事情感到沮丧。t<tab><tab>...sigh...<backspace>T<tab>Thunderbolt... B<tab><tab>...sigh...<backspace>b<tab>bluetooth...甚至不让我开始网络管理器重命名:)

我看到bash-completion 文件使用systemctl $1 list-units --all "$2*";

最好的方法是什么nocaseglob?

bash
  • 1 个回答
  • 19 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve