You are not logged in.
Hi,
I was trying to delete three partitions on a USB drive however I forgot to select the right device so I ended up deleting partitions on my hard-drive!
I used following command to delete partitions:
-----------------------
(parted) rm 2
(parted) rm 3
(parted) rm 4
-----------------------
then I used "rescue" command to restore the lost partitions and now my hard-disk partition looks like this:
---------------------------
(parted) print
Model: ATA WDC WD5000AAKX-0 (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1050MB 1049MB ntfs hidden, msftdata
2 1087MB 1360MB 273MB fat32 msftdata
3 1456MB 487GB 486GB ntfs msftdata
5 487GB 488GB 472MB ntfs hidden, diag
6 488GB 500GB 12.4GB ntfs hidden, diag
----------------------
It was Window 8 installed in the hard-disk.
However when tried to boot from the hard-disk, the BIOS seems not be able to find the hard-disk.
I can mount /dev/sda1 (Windows Recovery) and /dev/sda3 (Windows system and data) and looks like all the data is safe.
I'm wondering why I can't boot from the harddisk and how to fix it?
I'm new to Arch Linux and this is my first question in this forum. thanks in advance for any instruction.
Last edited by tawayee (2015-07-23 13:14:04)
Offline
BTW, I tried following commands and they didn't work:
(parted) set 1 boot on
(parted) set 1 legacy_boot on
(parted) set 3 boot on
(parted) set 3 legacy_boot on
(parted) disk_set pmbr_boot on
Offline
Offline
thanks for pointing to this tool. I'll try it when I get home tonight.
In the meanwhile, does anyone have any idea to fix it with the tool that Archlinux boot CD provides, such as 'parted' ?
Offline
pacman -S testdisk
testdisk /dev/sdX
photorec /dev/sdX
tetsdisk may not help you if you deleted the partitions but try [Quick Search] option if it will find the deleted files.
Also, take a look here
Last edited by alex.theoto (2015-07-22 16:12:32)
Offline
Please correct me if I'm wrong, but isn't this essentially a Windows issue? You've messed up the drive and now you can't boot Windows?
If you have access to a Windows recovery console, the commands described here might be of some help.
Offline
May I make a strong suggestion? You say the data are appear to be safe. I gather you do not have backups.
If my assertion is correct, stop. Back up the data before you do anything else.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Is this a UEFI system? Which bootloader were you using?
I assume it has been UEFI because of Windows 8. But you refer to BIOS and to legacy boot.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Is this a UEFI system? Which bootloader were you using?
I assume it has been UEFI because of Windows 8. But you refer to BIOS and to legacy boot.
Yes. It's UEFI. I'm just too used to saying BIOS...
Offline
Please correct me if I'm wrong, but isn't this essentially a Windows issue? You've messed up the drive and now you can't boot Windows?
If you have access to a Windows recovery console, the commands described here might be of some help.
You are right, it's not a Linux issue and I should have simply resolve the issue by using a Windows CD except I don't have it. But since I made this mistake during installation of Arch and I'm hoping to resolve the problem with a Linux tool, maybe I'm a bit justified ?
Offline
May I make a strong suggestion? You say the data are appear to be safe. I gather you do not have backups.
If my assertion is correct, stop. Back up the data before you do anything else.
thanks for the kind warning.
Offline
Partition 2 is where the EFI stuff should be. Can you mount that partition, and are the EFI files intact? Is your kernel there?
Are you using a bootloader (Grub? Gummiboot?) or are you using EFI stub to boot linux?
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Partition 2 is where the EFI stuff should be. Can you mount that partition, and are the EFI files intact? Is your kernel there?
Are you using a bootloader (Grub? Gummiboot?) or are you using EFI stub to boot linux?
I couldn't mount sda2. The error message is "can't read superblock". I got this partition back by using parted rescue command. I got sda3 back using the same command and I can mount sda3 and see the files.
I'm not having dual system in the hard disk so whatever the bootloader in the hard-disk I don't know. I expect the same loader is still in the disk and can boot the windows for me.
I boot archlinux from a ISO CD.
Offline
BTW, I tried following commands and they didn't work:
(parted) set 1 boot on
(parted) set 1 legacy_boot on
(parted) set 3 boot on
(parted) set 3 legacy_boot on
(parted) disk_set pmbr_boot on
Un-do these settings.
You need the EFI system partition (sda2) to be flagged as such.
Load up gdisk
# gdisk /dev/sda
Use "t" to change partition "2" to type "EF00" and use "p" to check -- /dev/sda2 should be listed under the "Name" column as "EFI System" -- then use "w" to write the changes to the disk.
You also have to set the boot flag:
# parted /dev/sda set 2 boot on
Once this is done, look at the contents of /dev/sda2 and check if there is a bootmgfw.efi file present (I think it's in Microsoft/EFI but I'm not sure):
# mount /dev/sda2 /mnt
# find /mnt -name bootmgfw.efi
Offline
I got my disk back!
Head_on_a_Stick 's tip is most helpful, I would have never thought about changing the partition type.
But that tip doesn't solve the problem that /dev/sda2 can't be mounted. I blindly tried to delete the partition 2 again and got it back using "parted rescue", and this time it returns with a different ending size. After this I can mount /dev/sda2 and see the EFI directory! I really don't know why this would work but i'm happy that it works...
and Head_on_a_Stick you are right, the bootmgfw.efi is under EFI/Microsfot/Boot directory.
After these the Windows is found at the boot up and it triggers some auto-repair process and now I got my full system back and everything is intact.
thanks to every one again for your tips!
Offline
Yay!
Please add "[SOLVED]" to the thread title for the benefit of others.
Offline