0

I used this code in the terminal of Ubuntu:

sudo mkdosfs -n 'Label' -I /dev/sdc

Does anyone know exactly what it means and what it does? I thought I was using it on my newly bought USB stick, but unfortunately, apparantly I used it on my hard disk, and it seems that all my files are lost. Literally all my files were on there and nowhere else. I bought the USB to make a back-up, so it happened exactly at the wrong time.

I really hope there is still a possibility to get my files back, does anyone know whether this is possible and how to do it?

Thanks a lot in advance.

User01
  • 45

3 Answers3

3

The command you ran formatted the drive to like a "super floppy" which basically formatted drive.

I wrote another answer here a while ago about file and partition recovery and using PhotoRec and Testdisk.

When in doubt of a command and what it does always look in the man pages.

~$ man mkdosfs

NAME
       mkfs.fat - create an MS-DOS filesystem under Linux


DESCRIPTION
       mkfs.fat is used to create an MS-DOS filesystem under Linux on a device
       (usually a disk partition).  DEVICE is the special  file  corresponding
       to the device (e.g. /dev/sdXX).  BLOCK-COUNT is the number of blocks on
       the device.  If omitted, mkfs.fat automatically determines the filesys‐
       tem size.

Which will format a drive to a MS-DOS filesystem.

The -n is only a name so no worries there, but the -I shows this:

   -I  It  is  typical  for  fixed  disk  devices to be partitioned so, by
       default, you are not permitted to create a  filesystem  across  the
       entire device.  mkfs.fat will complain and tell you that it refuses
       to work.  This is different  when  using  MO  disks.   One  doesn't
       always need partitions on MO disks.  The filesystem can go directly
       to the whole disk.  Under other OSes this is known as  the  'super‐
       floppy' format.  This switch will force mkfs.fat to work properly.

The last part shows that it forces mkfs.fat to work properly. Which means that it forced the program to format the drive as a MS-DOS partition wiping out everything you had on it. It will mount as a drive, but will not contain a normal partition on it like standard hard drives have. If you don't write anything to that drive since the format, there is a chance that you can get everything back, but there is never a guarantee of getting it back.

Hope this helps!

Terrance
  • 41,612
  • 7
  • 124
  • 183
1

I don’t think it is possible but try looking around on the internet for data recovery programs the only one I have found that may be suitable for your problem is testdisk just run this command:

sudo apt-get install testdisk

You may be able to use wine to use windows based programs. If you need I can search around and will list all the programs I have found and how to get them.

1

It seems you made a 'superfloppy' file system directly on the drive (without any partition structure). I am not sure if it wrote anything into the data storage part of the drive, maybe not.

If only the head of the drive was touched by this command, the file data are still there and can be recovered with PhotoRec. But it is a lot of work to recover the data that way, because the file names and the directory structure are lost.

If you are lucky, it is possible to recover the partition table with Testdisk.

See this link: www.cgsecurity.org/

-o-

If the data are very important, it is best to make a cloned copy of the drive to another drive of at least the same size, and do the recovery work on that drive. It is very important to be very cautious, when you clone, so that you do it in the correct direction, otherwise you will lose your data completely.

See this link: How can I get back the data of my USB on Ubuntu 16.04.1 LTS?

sudodus
  • 46,324
  • 5
  • 88
  • 152
  • Thank you for your answer! I have no idea how to make a cloned copy though. If I buy another hard drive of larger size, how would I proceed to make the copy? Normally I would just copy all files on it to the other one. – User01 Jan 02 '17 at 16:50
  • It is described in the link above 'How can I get back ...', https://askubuntu.com/questions/862224/how-can-i-get-back-the-data-of-my-usb-on-ubuntu-16-04-1-lts/862227#862227 and mkusb is easier and safer than ddrescue. – sudodus Jan 02 '17 at 16:55