Author Topic: i removed all my folders in External disk with cp command  (Read 1474 times)

0 Members and 1 Guest are viewing this topic.

Offline devjava55

  • Jr. Member
  • **
  • Posts: 4
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
i removed all my folders in External disk with cp command
« on: November 23, 2020, 08:58:14 pm »
hi,
i have a usb external disk mounted as /dev/mdxi . when i type cp ubuntu.iso /dev/mdxi, all my data in my external disk is removed and ubuntu.iso is extracted int my disk.how can i recover my data. i try to use TestDisk with photorec but it can't find my files.
thanks
« Last Edit: November 23, 2020, 09:45:21 pm by Keith »

Online Keith

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1441
  • Karma: 20
  • Gender: Male
  • Linux Novice
    • View Profile
    • Awards
Re: i removed all my folders on External disk with cp command
« Reply #1 on: November 23, 2020, 09:44:50 pm »
Hello Devjava - and welcome to the Forum.

I think you are out of luck. 
Extracting your ISO files over your data probably means your data is lost....and PhotoRec is really designed for image recovery, anyway. 
Sorry.

Keith

The Linux Community Forum

Re: i removed all my folders on External disk with cp command
« Reply #1 on: November 23, 2020, 09:44:50 pm »

Offline Mad Penguin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1495
  • Karma: 10024
  • Gender: Male
    • View Profile
    • Awards
Re: i removed all my folders in External disk with cp command
« Reply #2 on: November 25, 2020, 02:20:56 am »
Hi devjava,

I'm guessing you have an external disk referenced as /dev/mdxi mounted on your filesystem as something like /mnt/mdxi (?!)
("df" should confirm this)
Copying ubuntu.iso to the mount point should have copied the file to the filesystem on the device and left other files on the device in-tact.
Copying ubuntu.iso to the "device file" effectively copies the contents of ubuntu.iso block for block to your usb device. (rather than unpacking it as-such)
As .iso files are "mountable", your device (which now sounds like an image copy of ubuntu.iso) should also be mountable, and a copy of ubuntu.iso, block-for-block.
- as Keith says, I think you may be out of luck ...

Offline devjava55

  • Jr. Member
  • **
  • Posts: 4
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: i removed all my folders in External disk with cp command
« Reply #3 on: November 25, 2020, 05:47:02 pm »
can i recover  the data with on OS LInux  live , i think there is a OS used for Forenisc computing .  do you kniw a good one.

Offline Mad Penguin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1495
  • Karma: 10024
  • Gender: Male
    • View Profile
    • Awards
Re: i removed all my folders in External disk with cp command
« Reply #4 on: November 25, 2020, 06:12:08 pm »
Ok, so if you accidentally delete a file, what this effectively does is to remove the file name from the file index and mark the space associated with the file as available for use. If you stop using the system at "that" point, i.e. before the space is used up by something else, it's is generally possible to recover the data. However. What you have done is to replace your data, block for block, with new data, so on the face of it, there is nothing to recover as the data itself has been overwritten - at least for the first couple of G of data,

In terms of "how to the FBI do it?", overwriting a block on the disk could be analogous with writing something with pencil, erasing it with a rubber, then writing something new on top. What was there has gone, however with the right tools (maybe with some graphite powder etc) it may be possible to see an imprint of what was there and deduce what had previously been written. Now this relates to magnetic storage, not sure how it applies to solid state media, but either way I think it would likely require specialised (physical) tools, be expensive, and unlikely to produce very much that's usable. As far as I'm aware standard hardware can't recover overwritten blocks from any type of media.

If you think there may be data you want on the device "after" the first couple of G's, i.e. the size of the ubuntu ISO, you will need a tool that will scan your device at block level looking for valid file / directory entries .. the tool you need really depends on the filesystem that "was" on the device before it was overwritten. Were you using extfs, fat, or something else?


The Linux Community Forum

Re: i removed all my folders in External disk with cp command
« Reply #4 on: November 25, 2020, 06:12:08 pm »

Offline devjava55

  • Jr. Member
  • **
  • Posts: 4
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: i removed all my folders in External disk with cp command
« Reply #5 on: November 26, 2020, 10:01:01 am »
my disk has 320 Go but the iso file has just 1.2 Go so how can i get my other 318 Go  data, do you know any  software please

Online Keith

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1441
  • Karma: 20
  • Gender: Male
  • Linux Novice
    • View Profile
    • Awards
Re: i removed all my folders in External disk with cp command
« Reply #6 on: November 26, 2020, 11:59:06 am »
Devjava,

You might try using TestDisk recovery software which is free.  Look at https://www.tecmint.com/recover-deleted-files-using-testdisk-in-linux/ for downloading and using it. 

In desperation, you could use a professional company such as fieldsdatarecovery.  It might not be expensive and their URL is:
 https://fieldsdatarecovery.co.uk/?msclkid=5b16005e877017bff6985fe115e223f2&utm_source=bing&utm_medium=cpc&utm_campaign=UK%20FDR%20Phrase&utm_term=recover%20data&utm_content=Recover%20Data

I hope it helps you.  I've not tried either method, so can't advise on the detail. 
   Keith

Offline devjava55

  • Jr. Member
  • **
  • Posts: 4
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: i removed all my folders in External disk with cp command
« Reply #7 on: November 28, 2020, 05:22:27 pm »
hi with TestDisk i find my disk with a good size 320Go . i can get image.dd but all my folders and files name are new it s very hard to reorganize 300 Go. :(

Online Keith

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1441
  • Karma: 20
  • Gender: Male
  • Linux Novice
    • View Profile
    • Awards
Re: i removed all my folders in External disk with cp command
« Reply #8 on: November 28, 2020, 05:32:36 pm »
Do you mean that all your files are present but their names have been changed? 
And what operating system do you have on your computer?


The Linux Community Forum

Re: i removed all my folders in External disk with cp command
« Reply #8 on: November 28, 2020, 05:32:36 pm »

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal