0

This is the command that I ran in a sudoed terminal: dd if=/dev/zero of=/dev/sd* bs=512 count=32

These are the sd* using lsblk:

sda      8:0    0 238.5G  0 disk   
├─sda1   8:1    0   600M  0 part /boot/efi  
├─sda2   8:2    0     3G  0 part   
├─sda3   8:3    0 227.2G  0 part /  
└─sda4   8:4    0   7.8G  0 part [SWAP]  
sdb      8:16   1  29.5G  0 disk   
└─sdb1   8:17   1  29.5G  0 part /media/adminn/STRONTIUM  

I have not restarted the system yet. Is there a way I can recover the lost/corrupted data?

1
  • 1
    Edit question to show output of ls -l /dev/sd*? Commented May 4, 2020 at 12:41

1 Answer 1

3

I have not restarted the system yet. Is there a way I can recover the lost/corrupted data?

I doubt that you have lost any data. It looks like you got lucky. Do ls -l /dev/sd* to see what you did. There should be a file there that you did not expect.

9
  • OMG thx!! gorgeous file : ``` "-rw-r--r-- 1 root root 16384 May 4 16:30 '/dev/sd*'" and the rest brw-rw---- 1 root disk 8, 0 May 4 17:25 /dev/sda brw-rw---- 1 root disk 8, 1 May 4 17:25 /dev/sda1 brw-rw---- 1 root disk 8, 2 May 4 17:25 /dev/sda2 brw-rw---- 1 root disk 8, 3 May 4 17:25 /dev/sda3 brw-rw---- 1 root disk 8, 4 May 4 17:25 /dev/sda4 ``` How can i remove this sd* thing? If I had run of=/dev/sda instead, it would have had ruined the data right? how to recover in this case? Commented May 4, 2020 at 12:55
  • 4
    To delete it you need to quote: rm '/dev/sd*' so it does not expand the *. Practice before using sudo. Commented May 4, 2020 at 12:59
  • 1
    If it destroyed you data, then the recovery procedure is to re-install, and recover user-data from backup / remote-revision-control. Commented May 4, 2020 at 13:01
  • Worked beatifully! Thanks a lot for quick and correct reply. I hope you wouldn't mind if I ask you about what could we have done, if 16 bytes of data from all sda's were remove instead? Commented May 4, 2020 at 13:03
  • 2
    @Panki more precisely, it would be expanded, but it typically wouldn’t match anything (unless you happen to have an of= directory in the current directory, itself containing a dev directory, containing entries starting with sd), so the shell would either leave it as-is, remove entirely, or fail, depending on your glob settings. Commented May 4, 2020 at 13:19

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.