You are not logged in.

#1 2014-09-28 16:11:22

Jhon
Member
From: Russia
Registered: 2014-06-22
Posts: 5

Recovering earlier installed Windows 7 after installing Arch Linux

I'm trying to boot windows on my ASUS notebook.
There was windows 7 from the very beginning (disks C:\ and D:\), then I divided disk D:\ on several partitions and installed Arch Linux. I overwrited Windows boot information by boot part of Linux. Now I want to recover windows, that I still have on hard drive. It doesn's matter what there will be: dualboot or only windows (but dualboot is prefered).

Disk info:

[jhon@fckrsns ~]$ sudo fdisk -l

Disk /dev/sda: 698.7 GiB, 750156374016 bytes, 1465149168 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
Disklabel type: gpt
Disk identifier: 1AFC9DFF-CD3B-4CE1-8CAF-41C3E5B75772

Device           Start          End   Size Type
/dev/sda1         2048       411647   200M EFI System
/dev/sda2       411648       673791   128M Microsoft reserved
/dev/sda3       673792    586731519 279.5G Microsoft basic data
/dev/sda4    586731520    691589119    50G Linux filesystem
/dev/sda5   1412718592   1465147391    25G Windows recovery environment
/dev/sda6    691589120    901304319   100G Linux filesystem
/dev/sda7    901304320   1412718591 243.9G Microsoft basic data

[jhon@fckrsns ~]$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 698.7G  0 disk 
├─sda1   8:1    0   200M  0 part /boot
├─sda2   8:2    0   128M  0 part 
├─sda3   8:3    0 279.5G  0 part 
├─sda4   8:4    0    50G  0 part /
├─sda5   8:5    0    25G  0 part 
├─sda6   8:6    0   100G  0 part /home
└─sda7   8:7    0 243.9G  0 part 
sr0     11:0    1  1024M  0 rom                                                                                                                                                                                                                                                
[jhon@fckrsns ~]$ lsblk -f
NAME   FSTYPE LABEL    UUID                                 MOUNTPOINT                                                                                      
sda                                  
├─sda1 vfat            4DEB-D6D2                            /boot                                                                                                     
├─sda2                                       
├─sda3 ntfs   OS       62364BE9364BBCB3                                                                                                  
├─sda4 ext4            c4da4683-871a-49fa-96a3-4da11387d31d /                                                                 
├─sda5 ntfs   Recovery 8ECE4F50CE4F2FAF                                           
├─sda6 ext4            3eba01c6-e422-4542-8442-16064c74a563 /home                                                                 
└─sda7 ntfs            3B29E7794F6CD932                                       
sr0                  

OS partition (/dev/sda3):

[jhon@fckrsns /]$ ls /run/media/jhon/OS
altera         Boot          djvureader              DrWeb Quarantine  eSupport  hiberfil.sys  MSOCache                              N56VM.BIN  pagefile.sys  Program Files        Recovery       SecurityScanner.dll        VisualCLibs
AsusVibeData   bootmgr       Documents and Settings  eclipse           Games     Intel         MS.Office.2007.Portable.micro.v.1.16  N56VZ.BIN  PerfLogs      Program Files (x86)  $Recycle.Bin   System Volume Information  Windows
AVScanner.ini  BOOTSECT.BAK  DOSBox_SIM              END               gcc       Keil_v5       mtd                                   NVIDIA     ProgramData   Qt                   R.G. Catalyst  Users

I tried to recover MBR with different ways:
with syslinux:

[jhon@fckrsns /]$ sudo dd if=/usr/lib/syslinux/bios/mbr.bin of=/dev/sda
0+1 records in
0+1 records out
440 bytes (440 B) copied, 0.0226394 s, 19.4 kB/s

with ms-sys:

[jhon@fckrsns /]$ sudo ms-sys --partition /dev/sda1
Start sector 2048 (nr of hidden sectors) successfully written to /dev/sda1
Physical disk drive id 0x80 (C:) successfully written to /dev/sda1
Number of heads (255) successfully written to /dev/sda1
[jhon@fckrsns /]$ sudo ms-sys --mbr7 /dev/sda
Windows 7 master boot record successfully written to /dev/sda

But there is still no way to boot windows.
I run grub-mkconfig before and after these manipulations with MBR:

[jhon@fckrsns ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initramfs image: /boot/initramfs-linux-fallback.img
  No volume groups found
done

[jhon@fckrsns /]$ sudo os-prober 
  /dev/cdrom: open failed: No medium found
  No volume groups found

I installed rEFInd, now I have two choices on boot screen: vmlinuz-linux, which it founded, and my earlier installed grub bootloader.
Maybe I missed something, but i don't know what exactly.

Last edited by Jhon (2014-09-28 16:45:38)

Offline

#2 2014-09-28 16:20:13

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,551

Re: Recovering earlier installed Windows 7 after installing Arch Linux

Did you originally install windows 7 with gpt?


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#3 2014-09-28 16:23:29

Jhon
Member
From: Russia
Registered: 2014-06-22
Posts: 5

Re: Recovering earlier installed Windows 7 after installing Arch Linux

Windows was initialy installed on notebook - I bought it with Windows.

Offline

#4 2014-09-28 16:32:19

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,551

Re: Recovering earlier installed Windows 7 after installing Arch Linux

Is your system UEFI?


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#5 2014-09-28 16:36:36

Jhon
Member
From: Russia
Registered: 2014-06-22
Posts: 5

Re: Recovering earlier installed Windows 7 after installing Arch Linux

I'm not sure, but i think so.

[jhon@fckrsns ~]$ dmesg | grep "EFI"
[    0.000000] efi: EFI v2.31 by American Megatrends
[    0.615436] fb0: EFI VGA frame buffer device
[    0.659237] fb: switching to inteldrmfb from EFI VGA

Offline

#6 2014-09-28 16:52:19

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,551

Re: Recovering earlier installed Windows 7 after installing Arch Linux

If it is UEFI, then it should be partitioned gpt.  Your windows would've been installed gpt.  So all you need it to do is recognize on its' own all of those installations (and make sure your partition table is gpt).


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#7 2014-09-28 17:01:47

Jhon
Member
From: Russia
Registered: 2014-06-22
Posts: 5

Re: Recovering earlier installed Windows 7 after installing Arch Linux

[jhon@fckrsns ~]$ sudo fdisk -l
...
Disklabel type: gpt
...

Is this what i need, or there is another way to make sure partition is gpt?

Last edited by Jhon (2014-09-28 18:03:10)

Offline

#8 2014-09-28 17:04:17

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,551

Re: Recovering earlier installed Windows 7 after installing Arch Linux

Jhon wrote:
[jhon@fckrsns ~]$ sudo fdisk -l
...
Disklabel type: gpt
...

Is this that i need, or there is another way to make sure partition is gpt?

Above you tried to dd the mbr into place.  I wonder (effectively) which one you actually have going.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#9 2014-09-29 16:18:12

Jhon
Member
From: Russia
Registered: 2014-06-22
Posts: 5

Re: Recovering earlier installed Windows 7 after installing Arch Linux

Now I know that I don't need MBR at all (but google told me that recovering windows = recovering MBR..)
Are there any ways to recover boot information on EFI system partition from Linux without using Windows Live CD and it's bootrec.exe?
I have bootmgr and bootmgfw.efi files on /dev/sda3 (partition with windows installed), what else I need? Simple copy of bootmgfw.efi to /boot/EFI/Microsoft/Boot/bootmgfw.efi and addition of custom menu item to /etc/grub.d/40_custom does'nt work. There is Windows now in rEFInd and GRUB menus, but there is error on loading.

Offline

#10 2014-09-29 17:04:47

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,551

Re: Recovering earlier installed Windows 7 after installing Arch Linux

Reading the grub wiki, it looks like you can chainload into windows from the file above or there's a more complex example of how to make it work also.  Usually your grub2 will be installed in the UEFI partition.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

Board footer

Powered by FluxBB