0

I'm not a linux power user by any measure and managed to screw up my MBR. Currently I have access to Kali linux, and GRUB is working fine (Kali installed without problems.) While installing Kali it mentioned that it couldn't find any other operating systems on the HDD and recommended that I overwrite the MBR. I thought that was kind of strange but figured I could restore the MBR without too much trouble. I cannot see any indication that Windows is installed on any of the partitions that I can see in Kali linux (though I'm pretty sure it should be on sda1, but that says "Linux"). It probably has something to do with the way I set up the disks during the Kali setup - I said "do not mount" for the Windows partition.

Checking the GRUB command line I was able to discover (hd0,msdos1) contains a lost+found folder, but that's it. From my understanding of GRUB + Linux disk numbering, that corresponds to sda1 - so where are my files?

I don't know what other information I can provide to be of more use, but could really appreciate some help.

Edit: sudo fdisk -l output

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00071d9a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048   945407999   472702976   83  Linux
/dev/sda2       945410046   976771071    15680513    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5       945410048   972949109    13769531   83  Linux
/dev/sda6       972949504   976771071     1910784   82  Linux swap / Solaris
  • 1
    Please post the output of sudo fdisk -l. – terdon Jan 3 '14 at 23:51
  • Added to original post. – iLoch Jan 3 '14 at 23:55
  • also, the reason that Windows wasn't recognized is definitely because you didn't mount it. os-prober requires partitions to be mounted in order for proper recognition. (and please read tag descriptions! the grub tag is something we're getting rid of.) – strugee Jan 3 '14 at 23:56
  • If that is the entire output, it looks like you don't have a Windows system anymore. – terdon Jan 4 '14 at 0:00
  • @strugee Thanks for that. So where do I go from here. mount /dev/sda1 /mnt ? – iLoch Jan 4 '14 at 0:00
1

Seeing that you only have 13769531 Blocks (/dev/sda5), which is 6.5 GB's, tells me that the "successful" Kali Linux installation ended up either on /dev/sda5 (in the extended partition of /dev/sda2) but with errors. Or that you mistakenly selected /dev/sda1 as the partition to install Kali Linux after writing three new partitions to your disk. But if you want more information to be sure then you can continue on reading.

Go ahead and type dmesg | grep "No space" and if you see the completed sentence of "No space left on device a bunch of times and they point to /dev/sda5, then I'd skip to the bottom of the post, if not read on.

If you want to see what data is on your /dev/sda1 partition, first off, I would like to see if there is any data still on your "Windows" partition (assuming /dev/sda1). We will be using a program called parted which I stumbled upon while doing some further research. If you do not have parted then you can do:

{Kali Linux has parted pre-installed though...}

# apt-get install parted

Before we go further though I would like to just check if you are completely sure your /dev/sda1 partition did not mount. And we can check this by using the following command.

# df -Th | grep "sda"

If the output is suitable then you could technically remount the partition (sda) with the ro flag, also you should run parted /dev/sda print to see what file-system (If not already known) you have on the mysterious Linux typed parition (sda1). When you confirmed you know the current partition type of /dev/sda1 you can enter in the following command.

# mount -t {fstype) -o ro,remount /dev/sda1 {directory}

Another way you can check if there is data on your partition is is image the partition, clean/fix it, and mount the image of the fixed partition.

If you are at the bottom of this post it's either because you skipped here or because all of the above worked or didn't work and you want to recovery your /dev/sda1 partition that wasn't overwritten.

Insert another USB or external Hard Dsik to your machine, and type the following:

# fdisk -l

-- this is to get the mount-point of the drive you plugged in, usually the next letter in the sequence sdX where X is the letter after the previous. For example if sda was the only disk connected to your computer right now if you plugged in another drive that drive would know be labeled as sdbY where Y is the corresponding number to each partition on that drive.

$ mkdir /mnt/backup
$ mount /dev/sdb
$ dd if=/dev/sda1 of=/mnt/backup/sda.img
$ e2fsck -f /mnt/backup/sda.img

Then once dd is done cloning your /dev/sda1 partition re-install Kali Linux and delete the extended partition (/dev/sda2), and make another extended partition with one logical partition sized at least 10 GB's and the linux swap at least of (0.5 * total size of GB in RAM). Make sure you install Kali Linux to /dev/sdaY where Y is the logical disk destined to be your disk used for installing Kali Linux.

After everything is said and done, mount your image using the following after you re-inserted your device you used to hold your image and the X is the letter designated for that drive to be mounted along with the partition number.

$ mkdir /mnt/backup
$ mount /dev/sdX /mnt/backup
$ mount -o loop /mnt/backup/sda.img /mnt/sda-img

Hopefully all goes well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.