grep through 设备不起作用

grep through 设备不起作用

我创建了一个包含一些数据的文件:

root$ echo thisismydata > /etc/myfile

我可以 grep 该文件:

root$ grep -a "thisismydata" /etc/myfile 

thisismydata

我想验证我是否可以 grep 磁盘上的数据:

root$ grep -a "thisismydata" /dev/mapper/vg-root

什么也没找到。但该命令与其他数据一起工作正常:

root$ grep -a 'MIICNTCCA' /dev/mapper/vg-root
MIICNTCCAbygAwIBAgIJAMhaW/dIVfGbMAoGCCqGSM49BAMDMGAxCzAJBgNVBAYT
MIICNTCCAbygAwIBAgIJAMhaW/dIVfGbMAoGCCqGSM49BAMDMGAxCzAJBgNVBAYT
...

(该特定数据出现在我磁盘中的多个位置)

这里发生了什么?我怀疑文件可能尚未同步到磁盘,所以我做了:

root$ sync
root$ grep -a "thisismydata" /dev/mapper/vg-root

但仍然一无所获。

为什么在设备上找不到新创建的数据?

注意:这些是安装标志:

root$ mount | grep root
/dev/mapper/vg-root on / type ext4 (rw,relatime,seclabel,data=ordered)

编辑

根据要求,完整安装:

root$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=8101844k,nr_inodes=2025461,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuacct,cpu)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_prio,net_cls)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mapper/vg-root on / type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-usr on /usr type ext4 (rw,relatime,seclabel,data=ordered)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=32,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=13034)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel)
mqueue on /dev/mqueue type mqueue (rw,relatime,seclabel)
tmpfs on /tmp type tmpfs (rw,nosuid,noexec,relatime,seclabel,size=2097152k)
/dev/sda1 on /boot type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-repo on /repo type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-var on /var type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-home on /home type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-mysql on /var/lib/mysql type ext4 (rw,relatime,seclabel,data=ordered)
tmpfs on /var/www/html/app/cache type tmpfs (rw,nosuid,noexec,relatime,seclabel,size=262144k)
/dev/mapper/vg-backup on /var/backup type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-log on /var/log type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-audit on /var/log/audit type ext4 (rw,relatime,seclabel,data=ordered)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tmpfs on /run/user/0 type tmpfs (rw,nosuid,nodev,relatime,seclabel,size=1626632k,mode=700)

相关内容