首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏程序猿石头

    由一次磁盘告警引发的血案 | 你知道 du 和 ls 区别吗?

    @localhost ~]# dd of=sparse-file bs=1k seek=5120 count=0 0+0 records in 0+0 records out 0 bytes (0 B) -rw-r--r--. 1 root root 5242880 Nov 8 11:32 sparse-file [root@localhost ~]# ls -ls sparse-file 0 -rw-r --r--. 1 root root 5242880 Nov 8 11:32 sparse-file // 而 sparse-file 占用的存储空间为 0 个 block [root@localhost ~]# du sparse-file 0 sparse-file [root@localhost ~]# du -h sparse-file 0 sparse-file 此时若用 vim 打开该文件 staff 5242880 11 9 09:44 sparse-file ➜ ~ du sparse-file 10240 sparse-file 以上是用 dd 等命令创建稀疏文件,也有同学用

    62030发布于 2020-07-14
  • 来自专栏程序猿石头

    磁盘又双叒叕满了~

    @localhost ~]# dd of=sparse-file bs=1k seek=5120 count=0 0+0 records in 0+0 records out 0 bytes (0 B) -rw-r--r--. 1 root root 5242880 Nov 8 11:32 sparse-file [root@localhost ~]# ls -ls sparse-file 0 -rw-r --r--. 1 root root 5242880 Nov 8 11:32 sparse-file // 而 sparse-file 占用的存储空间为 0 个 block [root@localhost ~]# du sparse-file 0 sparse-file [root@localhost ~]# du -h sparse-file 0 sparse-file 此时若用 vim 打开该文件 9 09:44 sparse-file ➜ ~ du sparse-file 10240 sparse-file 以上是用 dd 等命令创建稀疏文件, 也有同学用 c 代码实现了相同的功能。

    1.6K40发布于 2021-11-10
  • 来自专栏程序猿石头

    由一次磁盘告警引发的血案

    用 dd 命令生产一个文件, 上例中为从标准输入中读取 count=0 个block, 输出到 sparse-file 中, 一个 block 的大小为1k(bs=1k), 输出时先将写指针移动到 seek

    50130发布于 2020-07-14
领券