This question already has an answer here:

I wanted to install an ISO of Linux on a regular CD, sadly it was installed on my external backup HDD which i had on my computer. Now i have an ISO image ~2gb on it. As i said it is my backup HDD, so the data on it is really important. How can i remove the ISO and get my data back?

I already installed testdisk and making an analysis with it if i can somehow restore it. Sadly I am not an expert in recoveries, i luckily never had to do one.

Searching the internet I mainly found how to recover ISOs on usb flash drives. Since I am pretty new to Ubuntu, I would massively appreciate a step by step guide, if possible.

Filesystem      Size  Used Avail Use% Mounted on
udev            4,1G     0  4,1G   0% /dev
tmpfs           823M  2,2M  821M   1% /run
/dev/sda2       248G   29G  207G  13% /
tmpfs           4,2G   68M  4,1G   2% /dev/shm
tmpfs           5,3M  4,1k  5,3M   1% /run/lock
tmpfs           4,2G     0  4,2G   0% /sys/fs/cgroup
/dev/loop0       91M   91M     0 100% /snap/core/4571
/dev/loop2      210M  210M     0 100% /snap/gimp/40
/dev/loop1       34M   34M     0 100% /snap/gtk-common-themes/3
/dev/loop3       91M   91M     0 100% /snap/core/4650
/dev/loop4       37M   37M     0 100% /snap/gtk-common-themes/319
/dev/loop5      129M  129M     0 100% /snap/winds/63
/dev/loop6      166M  166M     0 100% /snap/gitkraken/62
/dev/loop7      166M  166M     0 100% /snap/gitkraken/58
/dev/loop8      190M  190M     0 100% /snap/vlc/190
/dev/loop9      496M  496M     0 100% /snap/intellij-idea-community/48
/dev/loop10     4,0M  4,0M     0 100% /snap/gnome-system-monitor/41
/dev/loop11      97M   97M     0 100% /snap/zenkit/1
/dev/loop12     223M  223M     0 100% /snap/gimp/39
/dev/loop15     107M  107M     0 100% /snap/bitwarden/4
/dev/loop16     147M  147M     0 100% /snap/gnome-3-26-1604/64
/dev/loop14     131M  131M     0 100% /snap/ghost-desktop/46
/dev/loop13      65M   65M     0 100% /snap/pencilsheep/5
/dev/loop17     4,0M  4,0M     0 100% /snap/gnome-system-monitor/45
/dev/loop18     218M  218M     0 100% /snap/gimp/38
/dev/loop19     208M  208M     0 100% /snap/vlc/365
/dev/loop21     496M  496M     0 100% /snap/intellij-idea-community/51
/dev/loop20      94M   94M     0 100% /snap/ktube-media-downloader/2
/dev/loop22      11M   11M     0 100% /snap/dosbox-x/11
/dev/loop23      91M   91M     0 100% /snap/simplescreenrecorder/1
/dev/loop24     543M  543M     0 100% /snap/supertuxkart/8
/dev/loop25     154M  154M     0 100% /snap/skype/30
/dev/loop26     543M  543M     0 100% /snap/supertuxkart/6
/dev/loop27     4,0M  4,0M     0 100% /snap/gnome-system-monitor/39
/dev/loop28      11M   11M     0 100% /snap/currate/5
/dev/loop31     144M  144M     0 100% /snap/skype/33
/dev/loop29     166M  166M     0 100% /snap/gitkraken/54
/dev/loop30     130M  130M     0 100% /snap/winds/64
/dev/loop32     166M  166M     0 100% /snap/inkscape/4019
/dev/loop33     266M  266M     0 100% /snap/electronic-wechat/7
/dev/loop34      96M   96M     0 100% /snap/vectr/2
/dev/sda1       536M  4,9M  531M   1% /boot/efi
tmpfs           823M   17k  823M   1% /run/user/121
tmpfs           823M   99k  823M   1% /run/user/1000
/dev/loop35     496M  496M     0 100% /snap/intellij-idea-community/58
/dev/sdb1       2,1G  2,1G     0 100% /media/rhu/Ubuntu-MATE 18.04 LTS amd64 

marked as duplicate by sudodus, karel, Fabby, Kevin Bowen, Eric Carvalho Jun 14 '18 at 13:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Have you rebooted or shutdown your computer yet? If not, maybe the accepted answer at the following link (to a similar question) may help. Accidentally did dd /dev/sda. Otherwise Testdisk and Photorec may be the tools you need. (But the data that were stored in the first 2 GB of the drive are overwritten and lost.) – sudodus Jun 12 '18 at 19:44
  • It's quite easy to see the files in your ISO and extract them. When you plug in your external HDD does it automatically mount. eg in /media/username? – Paul Benson Jun 12 '18 at 23:04
  • @PaulBenson Sadly a partition of 2 gb was created. But it does mount and and asks me what to do. When opening the folder tho i just can see the iso files – R. Hu Jun 13 '18 at 10:51
  • Was the external HD NTFS? In any case, if it was just a backup drive, the easiest thing is just to do a backup again. – Andrea Lazzarotto Jun 13 '18 at 12:35
  • I'm confused. If you can see your files in Ubuntu once you've plugged in your HDD, then by definition it has to be mounted. Just to clear this up plug in your HDD, start it up then open Terminal. Type df -H. Please print output. – Paul Benson Jun 13 '18 at 13:12