我希望这不是一个大问题,但最终可能会成为一个很大的问题。
在某些情况下,我错误地在我的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/sdt
。kes!
我现在正在尝试弄清原始内容/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
我惊讶地发现我的Mac Book Air确实具有/ dev / sdt字符特殊设备。由于我无法理解其本质,因此我查找了适用于Unix Geeks的Mac OS X副本。在第60页上,/ dev中有所有条目的列表。确实提到了sdt,并给出了不明智的解释:
sdt无证
这是整本书中唯一提及的内容。
因此,首先它不是存储设备。其次,您不太可能会对此做任何事情。同时,我看不出有什么真正的理由要担心。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句