Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am not a Linux user, and was doing some homework, I blindly typed sudo mkfs ext3 dev/sda2 (I had Ubuntu as Windows installation).

I've done few more things, and turned Ubuntu off to switch on Windows back. No operating system installed - this is the message I'm getting. I plugged my HDD onto another computer and all my files are still there.

What should I do to get my windows installation back?

df -l (before mkfs)
/dev/loop0             29G  2,0G   27G   8% /
udev                  3,0G  4,0K  3,0G   1% /dev
tmpfs                 1,2G  900K  1,2G   1% /run
none                  5,0M     0  5,0M   0% /run/lock
none                  3,0G  1,3M  3,0G   1% /run/shm
/dev/sda3             455G  123G  333G  27% /host
/dev/sdb1             1,9G  820M  1,1G  43% /media/PHONE CARD

mkfs output (polish, sorry)

mke2fs 1.41.14 (22-Dec-2010) 
Etykieta systemu plików=

Typ OS: Linux 
Rozmiar bloku=1024 (log=0) 
Rozmiar fragmentu=1024 (log=0) 
Stride=0 bloków, szerokość Stripe=0 bloków 
25688 i-węzłów, 102400 bloków 
5120 bloków (5.00%) zarezerwowanych dla superużytkownika 
Pierwszy blok danych=1 
Maksymalna liczba bloków systemu plików=67371008 
13 grup bloków 
8192 bloków w grupie, 8192 fragmentów w grupie 
1976 i-węzłów w grupie 
Kopie zapasowe superbloku zapisane w blokach:  
    8193, 24577, 40961, 57345, 73729 

Zapis tablicy i-węzłów: zakończono                       
Tworzenie kroniki (4096 bloków): wykonano 
Zapis superbloków i podsumowania systemu plików: wykonano 

Ten system plików będzie automatycznie sprawdzany co każde 30 montowań 
lub co 180 dni, zależnie co nastąpi pierwsze. Można to zmienić poprzez 
tune2fs -c lub -i.

after testdisk (analyze + write)

fdisk -l
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    23179263    11588608   27  Hidden NTFS WinRE
/dev/sda2   *    23179264    23384063      102400   83  Linux
/dev/sda3        23384064   976771071   476693504    7  HPFS/NTFS/exFAT

So sda2 is my windows installation, and it got changed from ntfs to ext3.

share|improve this question
up vote 1 down vote accepted

It seems you formatted the boot partition of Windows! No worries then. Before you continue, I advise you always to backup your precious data! What you need to do is restore the boot partition of Windows. Running the official recovery tool when booting Windows should do the trick. Other tools might be out there, but the Windows recovery tools are created for these kind of issues. You can run these by pressing a certain key while booting, or by booting from your Installation Disk. For Windows XP you need your installation CD, for Windows 7 you have to press F8 while booting. Good luck!

share|improve this answer
yeh i had troubles with that, cause vaio had prolly overwritten windows rescue, and vaio resue doesn't have option to fix boot alone. I had to get some windows recovery disc to do that. Thank you ;) – Filip Podgórny Jun 7 '12 at 18:33
Great to hear you fixed it! – sirhCity Jun 8 '12 at 0:38

It's not too late to recover your files, since you probably only edited the partition table. It's important not to start using it though!

What I suggest is to make sure the partition does not get mounted. A safe way to accomplish this is to boot with an operating system such as GParted Live or Parted Magic. The last time I checked, Parted Magic is included in the great compilation of tools that Ultimate Boot CD provides, but both GParted Live and Parted Magic are individually downloadable.

Next thing to do is to revert the changes you made with mkfs. In my knowledge a true revert is not possible, so if I'd have to do it, I'd format sda2 as ntfs and run a ntfs file recovery tool on it. GParted Live and Parted Live both come with tools that should help you out here (especially the latter one).

I think a real revert is only possible if you backed up your partition table. I did that before and that worked for me, so that may be a good thing to make use of in the future. I suggest that you use TestDisk or a tool alike to make sure you have no backups though, because maybe the MFT (or any other data for that matter) is automatically backed up!

If you did use the partition and mounted it with write access, chances are that files are already overwritten. You'll then have a greater challange at hand, but with special tools recovery is possible.

If you're looking for a rescue tool, take a look at TestDisk, I always used it with great success. I know for sure it is included on Parted Magic.

share|improve this answer
I used testdisk, and as you can see in edited question, it sees my primary bootable (originally ntfs) partition as linux ext3 one, but all my files are here and are still accessible! Thats why I don't want to format it, is there any other option of changing it back to ntfs? something like mkfs ntfs? ;o or any other tool that does not format the disc...? – Filip Podgórny Jun 5 '12 at 15:20
I'd be extremely careful with trying to just fix the partition table. It will be safer if you just backup the files (external hard drives are getting pretty cheap) and format the drive. It might be possible to do something, but I wouldn't even attempt something without a backup. – Rob Jun 5 '12 at 17:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .