在LUKS/ dm-crypt/ cryptsetup FAQ页面说:
2.15 我可以调整 dm-crypt 或 LUKS 分区的大小吗?
是的,您可以,因为 dm-crypt 和 LUKS 都不存储分区大小。
我一头雾水:
如果没有存储大小信息,什么是“调整大小”?
如何在加密卷的打开/关闭过程中记住“调整大小”?
是否有任何理由不在--sparse=always每次调用时使用 use cp?
info cp 说:
Run Code Online (Sandbox Code Playgroud)‘--sparse=WHEN’ A “sparse file” contains “holes”—a sequence of zero bytes that does not occupy any physical disk blocks; the ‘read’ system call reads these as zeros. This can both save considerable disk space and increase speed, since many binary files contain lots of consecutive zero bytes. By default, ‘cp’ detects holes in input source files via a crude heuristic and makes the corresponding output file sparse as well. Only regular …
我相信我的交换/硬件/驱动程序发生了一些奇怪的事情。
我正在尝试将交换大小增加swapoff, lvresize,然后swapon再次增加。
当我这样做时swapoff /dev/swapdev,该命令花了 8 分 19 秒将大约 3.5GB 的交换页面移动到内存中。
在运行之前swapoff,我确保我的空闲 RAM 大于交换使用量,并且在运行时保持正确。
我有一台带有 SSD HDD 的 Intel Core i5 笔记本电脑。处理器之前不到 10% swapoff,而当我签入时,swapoff正在使用 70%+ CPU。
一直以来,杂志上都没有什么有趣的东西。
以下是我预计将 3.5G 从磁盘分流到内存所需的时间:
$ time dd if=/dev/urandom of=/tmp/del bs=1M count=3500
3500+0 records in
3500+0 records out
3670016000 bytes (3.7 GB, 3.4 GiB) copied, 23.7288 s, 155 MB/s
real 0m24.789s
user 0m0.000s
sys 0m22.743s
Run Code Online (Sandbox Code Playgroud)
我在跑 Linux svelte 4.9.53-1-MANJARO #1 SMP PREEMPT Thu …
如何在终端中打印 256 色测试图案?
我想检查我的终端是否正确支持 256 色。
根据我对/etc/systemd选项的理解,这noauto意味着该设备不会在启动时(或使用mount -a)安装。
如果已经给出,是否有任何添加会nofail改变行为的情况noauto,或者它是完全多余的?
man systemd.mount(5) 说:
使用
noauto,此挂载不会作为 local-fs.target 或 remote-fs.target 的依赖项添加。这意味着它不会在引导期间自动安装,除非它被其他一些单元拉入。使用
nofail,local-fs.target 或 remote-fs.target 只需要这个挂载,不需要。这意味着即使此挂载点未成功挂载,引导也会继续。
自动挂载情况如何?
我正在尝试创建一个循环设备,并收到一个我不明白的错误:
# losetup -f /media/2TB/sdb2-fix-file
losetup: cannot find an unused loop device
Run Code Online (Sandbox Code Playgroud)
我没有设置循环设备。的输出losetup -a为空,并且:
# ls -l /dev/loop*
crw-rw---- 1 root disk 10, 237 Oct 4 15:50 /dev/loop-control
Run Code Online (Sandbox Code Playgroud)
跑步losetup -D根本没有帮助。
为什么会出现这种情况?
下面是完整的strace输出:
Run Code Online (Sandbox Code Playgroud)# strace -fs80 losetup -f /media/2TB/sdb2-fix-file execve("/usr/bin/losetup", ["losetup", "-f", "/media/2TB/sdb2-fix-file"], 0x7ffc6fe88c38 /* 164 vars */) = 0 brk(NULL) = 0x55a51e754000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=215090, ...}) = 0 mmap(NULL, …
在模仿 MacOS 的终端open命令或 Window 的终端命令时start,此答案的注释建议将 stdout 和 stderr 附加到~/.xsession-errors,例如 ( bash):
alias open='&>>~/.xsession-errors xdg-open'
Run Code Online (Sandbox Code Playgroud)
我预见到的问题是竞争条件。lsof ~/.xsession-errors显示 22 个进程打开文件进行写入。
如何防止两个进程写入相同的偏移量~/.xsession-errors?
的词源是$PWD什么?是首字母缩略词吗?
我知道有一个pwd打印工作目录的命令,但在我看来,$CWD为当前工作目录命名变量会更有意义,因为 shell 变量包含数据,而不是打印它们。
在 bash 中,我可以写:
caller 0
Run Code Online (Sandbox Code Playgroud)
并接收调用者上下文的:
这对于调试非常有用。鉴于:
yelp () { caller 0; }
Run Code Online (Sandbox Code Playgroud)
然后我可以写yelp来看看到达了哪些代码行。
我可以实现caller 0在bash如下:
echo "${BASH_LINENO[0]} ${FUNCNAME[1]} ${BASH_SOURCE[1]"
Run Code Online (Sandbox Code Playgroud)
我怎样才能获得相同的输出caller 0中zsh?
shell ×2
automounting ×1
btrfs ×1
colors ×1
concurrency ×1
coreutils ×1
cp ×1
cryptsetup ×1
debugging ×1
dm-crypt ×1
files ×1
fstab ×1
function ×1
history ×1
linux ×1
logs ×1
loop-device ×1
luks ×1
mount ×1
pwd ×1
sparse-files ×1
swap ×1
systemd ×1
terminal ×1
tmux ×1
volume ×1
x11 ×1
xterm ×1
zsh ×1