如何检查/ dev / sdt的内容

黑崎一护

我希望这不是一个大问题,但最终可能会成为一个很大的问题。

在某些情况下,我错误地在我的27英寸iMac上运行了以下命令:

sudo dd if=ubuntu-rescue.img of=/dev/sdt bs=1m

之后,它给了我以下输出:

233+1 records in
233+1 records out
244570112 bytes transferred in 2.275065 secs (107500277 bytes/sec)

问题是,我不想将ubuntu-rescue.img移​​到的位置/dev/sdtkes!

我现在正在尝试弄清原始内容/dev/sdt/什么(在我错误地将数据写入该文件之前),以及是否有一种方法可以检查内容(删除错误地复制到那里的磁盘映像,或者以某种方式)将内容/dev/sdt恢复为原始状态)。

另外,此dd命令会擦除之前存在的所有内容,还是仅向其中添加数据?

目前对我来说主要的问题是,我不知道是什么/dev/sdt(文件,驱动程序,已安装的驱动器?等),因此我无法知道如何检查所造成的损坏。因此,我需要了解运行此命令时正在查看的内容:

ls /dev

以及如何检查/访问/读取这些文件的内容。

我该怎么办?


For some further analysis, here are various output from various commands:

Not a directory:

    $ cd /dev/sdt
    -bash: cd: /dev/sdt: Not a directory

"Special Character" file

    $ file /dev/sdt
    /dev/sdt: character special

Verbose ls output:

    $ ls -l /dev/sdt
    crw-rw-rw-  1 root  wheel    0,   0 Dec 28 14:02 /dev/sdt

"Size of" `/dev/sdt`

    $ du -sk /dev/sdt
    0    /dev/sdt

I ran the same commands from update #1 on a new Mac Mini (that didn't have its `/dev/sdt` drive tampered with `dd`, and it gave me the **exact same** output as I got on the the iMac after I ran the erroneous `dd` command. Does this mean that the /dev/sdt didn't "record" the contents of the dd transfer? Because the "size" of /dev/sdt displays as zero when I run `$ ls -l /dev/sdt`. Could it be that I got lucky and didn't do any permanent damage?

Both of these commands: `$ du -sk /dev/sdt` and `$ ls -l /dev/sdt` give me the same results on the iMac (where the erroneous `dd` command was run) as it did on the untouched Mac Mini, showing that the data stored in `/dev/sdt` reads at 0 bytes. This makes me assume that this drive is a temporary system drive that is not meant to store data, because even after 240 MB of data was erroneously `dd`'d into it, it still reads at zero byes.

Lastly, I was given a good idea (by user frostschutz) to run this command:

    dd if=/dev/sdt of=mystery bs=1M count=234

And compare the results of the "mystery" file with the contents of the ubuntu-resuce.img, and the output from that experimental `dd` left me with a file called "mystery" which was exactly zero bytes. So I am starting to feel confident that I didn't do any lasting damage, and that this drive is always empty.

After listening to your very helpful discussions, and reading more on an [another (separate, but closely-related) question of mine here on U&L][1], I discovered that my question has already been asked, so for anyone wanting to read more on this discussion, you can look [here][2].

  [1]: https://unix.stackexchange.com/questions/176304/why-does-the-unix-system-need-so-many-0-byte-drives-at-dev?noredirect=1#comment291323_176304
  [2]: https://unix.stackexchange.com/questions/18239/understanding-dev-and-its-subdirs-and-files



马里乌斯·马蒂西亚(MariusMatutiae)

我惊讶地发现我的Mac Book Air确实具有/ dev / sdt字符特殊设备。由于我无法理解其本质,因此我查找了适用于Unix GeeksMac OS X副本在第60页上,/ dev中有所有条目的列表确实提到了sdt,并给出了不明智的解释:

sdt无证

这是整本书中唯一提及的内容。

因此,首先它不是存储设备。其次,您不太可能会对此做任何事情。同时,我看不出有什么真正的理由要担心。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何查看/dev/sda 文件的内容?

来自分类Dev

检查/ dev / log

来自分类Dev

如何检查从/ dev / random读取是否会阻止

来自分类Dev

如何检查从/ dev / random读取是否会阻止

来自分类Dev

如何从shell中检查stdin是否为/ dev / null?

来自分类Dev

如何检查是否有东西写入/ dev / log?

来自分类Dev

如何检查Noobaa桶的内容

来自分类Dev

如何检查可选的@ViewBuilder内容

来自分类Dev

如何检查/ etc / localtime的内容?

来自分类Dev

删除目录内容 Web dev

来自分类Dev

/ dev / stdin,/ dev / stdout和/ dev / stderr的移植性如何?

来自分类Dev

如何选择/ dev / sda和/ dev / sdb?

来自分类Dev

如何选择/ dev / sda和/ dev / sdb?

来自分类Dev

如何从C挂载/ dev?

来自分类Dev

如何摆脱/ dev / loopN

来自分类Dev

如何创建/ dev / null?

来自分类Dev

如何摆脱/ dev / loopN

来自分类Dev

如何增加/ dev的大小?

来自分类Dev

如何从 C 挂载 /dev?

来自分类Dev

如何删除 /dev/loops

来自分类Dev

angularjs指令:如何检查被包含的内容

来自分类Dev

如何检查Geb模块“内容”是否存在?

来自分类Dev

如何检查以python上传的内容类型文件?

来自分类Dev

如何检查传递给filter()函数的内容

来自分类Dev

如何使用Powershell检查Spring Actuator的内容

来自分类Dev

如何检查页面是否包含内容?

来自分类Dev

如何检查我要提交的内容?

来自分类Dev

如何检查可迭代对象的内容?

来自分类Dev

如何检查分区的原始内容?