LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-14-2008, 03:38 PM   #1
Quercus ruber
Member
 
Registered: Mar 2004
Location: Bocholt, Germany
Distribution: Slackware
Posts: 135

Rep: Reputation: 24
have to reinstall windows - will I lose linux?


Hi

I shrunk a ntfs partition today with gparted so I could install another distro. Just to check, I tried to boot back to M$ and was presented with a blank screen, which remained blank whilst I hung a couple of sheets of wallpaper in the guest room. I rebooted to my live gparted cd and when I tried to resize the partition back to how it was, it reported a corrupt partition error.
Now, I have a vista rescue disk that came with the laptop. It is not a vista install disk, but an "operating system recovery dvd" It goes on to say (on the disk label) that "all data, applications and settings will be deleted". What are the chances that it will reformat my entire disk? Will it just see the NTFS partitions (for some reason there are 3 of them) and pop vista onto those. I know it will wipe the mbr but I can cope with that.
If it wasn't for an ancient version of age of empires which my husband and children are addicted to, I'd just wipe vista, but AofE won't run with wine. I've tried. Lots of times. Any advice would be appreciated.

Ros
 
Old 08-14-2008, 03:50 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
If you have not done so already then boot a liveCD and back up everything you have to some sort of removable media.

-----------------------
Steve Stites
 
Old 08-14-2008, 03:51 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Rescue CDs vary a lot, as do different versions of Windows. I've no experience with Vista, but since it's not an off the shelf edition, it's very hard to say. If I were in your shoes, I would assume the worst - that it will nuke everything. In short - don't leave to to chance - backup!

Last edited by matthewg42; 08-14-2008 at 04:27 PM.
 
Old 08-14-2008, 06:01 PM   #4
fair_is_fair
Member
 
Registered: May 2005
Posts: 516

Rep: Reputation: 52
Another route to try is GAG. Its a boot manager. You could try to install it and specify your windows partition. It may boot windows up successfully but it will not boot your linux installs only because bootloaders were not installed to partitions.

No harm will be done in trying. If you need to reinstall windows it will simply overwrite GAG.

http://gag.sourceforge.net/
 
Old 08-14-2008, 06:27 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I had a similar situation with my new laptop. I used Vista to resize the NTFS partition. That tends to work better, but unfortunately, Vista was too greedy on how much space it claimed it needed. So I resized it again in Linux and needed to fix up grub in rescue mode, and then after chainloading Vista, let Vista recheck the filesystem. You should be able to chainload the partition that Vista is on from the rescue disk, and then latter fix grub's menu.lst and the /etc/fstab entries to reflect your changes. If the Vista partition is intact, then you don't need to reinstall Vista.
 
Old 08-15-2008, 01:44 AM   #6
Quercus ruber
Member
 
Registered: Mar 2004
Location: Bocholt, Germany
Distribution: Slackware
Posts: 135

Original Poster
Rep: Reputation: 24
to reinstall or not to reinstall?

Well thanks for all those replies.
My mbr is still there. Let me explain what I did. I got a new laptop at Christmas with vista preinstalled. The disk was partitioned as follows:
a bootable partition of 1 mb,
NTFS with label WinRE - don't know what this is for 6 of 11 gigs are used
NTFS with label System - this is where my data is 21 of 44 gigs are used
NTFS with label DATA - don't know what this is for either 3 gigs are used

I tried to shrink the System (my music etc) partition under vista, but it was greedy as jschiwal said, so I used gparted to reshrink it. I then reallocated the free space to a /, swap and /home and installed linux. All was fine and well. Everything worked. That was months ago. I should have left it as it was. But, much to my joy, my mum wanted to put linux on her laptop, but as she lives in England and I live in Germany, I decided the easiest thing to do would be to free up a bit more space and install with her over the phone. Well, her install went fine, but mine didn't. I forgot to boot into vista and defrag the partition labelled DATA before resizing - I never use vista anyway. This DATA partition - I'd never touched it. Anyway, I resized it with gparted, booted up to vista to make sure all was well, and it wasn't. I chose vista from my boot menu and left it to its own devices for an hour or so and it was just sitting there quietly, not doing a thing. My linux works fine.

In the meantime I'm backing up all my linux stuff and then when that's finished, I'll pop this system rescue disk in and see what it does to my hard disk. Thanks for your help thus far. I'll let you know how it all goes. I might leave it til after the weekend when all are back at school and work....

ros
 
Old 08-15-2008, 03:00 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you inserted a partition after shrinking, the the grub entry for Vista may need to be changed. I am guessing that WinRE stands for Windows restore and is used to restore the sytem. The original second one may be where Vista is installed. The Vista grub entry in /boot/grub/menu.lst may look like this:
Code:
title Windows Vista
    rootnoverify (hd0,5)
    chainloader (hd0,1)+1
Look at the output of "sudo /sbin/fdisk -l". This command will list your partitions. One thing you can try even if you can't boot into either Vista or Linux is to explore the partitions in the grub shell. It has tab completion. If you find one with a "Windows" directory, it is probably the one to try to boot from.

In the grub shell, enter:
chainloader (hd
and press the tab key. With one drive, there will be only one choice (hd0.
Then add a comma and press tab again to get your choice of partitions. Suppose you try "(hd0,1)/" and press the tab key. If this one has the Windows directory, try
chainloader (hd0,1)+1
boot

If windows boots, it may take some time while it checks out the filesystem.

Good luck. When you can't boot, sometimes some trial and error can get you going again. If you can boot into Vista this way, and can boot into Linux, then edit your /boot/grub/menu.lst file and then run as root "grub-install /dev/sda2" ( for (hd0,1) ) to reinstall grub.

Sometimes you need to resort to a bit of trickery to get a system to boot up ok.
Code:
###Don't change this comment - YaST2 identifier: Original name: windows 1###
title windows 1
    rootnoverify (hd0,0)
    map (hd0) (hd3)
    map (hd3) (hd0)
    chainloader +1
This will swap the first and forth hard disk. You may need to do something similar if you add a disk.

Sometimes bios will say one drive is first while the kernel says a different one is first. This can happen on some computers if you have both ide and sata drives. The problem then is that grub sees the drives differently when first booting then grub-install would after booting up. This makes fixing up menu.lst difficult. The solution is to edit the file /boot/grub/device.map.
Code:
(hd0)   /dev/sda
(hd1)   /dev/sdb
It maps the kernels /dev/sd# device numbering with grubs (hd#) device numbering. If the problem I mentioned exists, you can try changing it to:
(hd0) /dev/sdb
(hd1) /dev/sda

And then run "grub-install /dev/sdb" to reinstall grub with changes.

Good Luck!
 
Old 08-21-2008, 02:24 AM   #8
Quercus ruber
Member
 
Registered: Mar 2004
Location: Bocholt, Germany
Distribution: Slackware
Posts: 135

Original Poster
Rep: Reputation: 24
Thumbs up All's well - backed up and recover dvd is comprehensive

Hi folks, thanks for all your help. I've backed up everything - I know I should do that now and again anyway. Then I popped in the vista rescue disk, which gave me a pretty green vista screen and nothing else, so I reset the bios - not that I'd changed it at all but I was running out of ideas and I'd backed up my data anyway. When I rebooted with the dvd I got the recover your vista dialog which was very comprehensive and I opted for the "repair your existing installation" checkbox and everything was fine. I resized the DATA partition from within vista, although that's rather academic now that I've bought a 500GB external usb drive!
Oh, if only I could get rid of vista altogether. It's just Age of Empires and that usb TV thing, which I'm working on and is really a topic for another post.

So really I have no idea what the problem was, but it seems to have been solved in that everything in my grub file boots as it should.

Incidentally, my grub entry, which I haven't changed for months looks like this:

Code:
timeout 10
color black/cyan yellow/cyan
gfxmenu (hd0,4)/usr/share/gfxboot/themes/pclinuxos/boot/message
default 0

title linux
kernel (hd0,4)/boot/vmlinuz BOOT_IMAGE=linux root=/dev/sda5 acpi=on resume=/dev/sda6 splash=silent vga=773
initrd (hd0,4)/boot/initrd.img

title linux-nonfb
kernel (hd0,4)/boot/vmlinuz BOOT_IMAGE=linux-nonfb root=/dev/sda5 acpi=on resume=/dev/sda6
initrd (hd0,4)/boot/initrd.img

title Slackware 12 @ sda8 by chainloading
root (hd0,7)
chainloader +1

title failsafe
kernel (hd0,4)/boot/vmlinuz BOOT_IMAGE=failsafe root=/dev/sda5 failsafe acpi=on resume=/dev/sda6
initrd (hd0,4)/boot/initrd.img

title windows
root (hd0,0)
makeactive
chainloader +1

title memtest-2.01
kernel (hd0,4)/boot/memtest-2.01.bin BOOT_IMAGE=memtest-2.01 

title 2.6.22.17.tex2
kernel (hd0,4)/boot/vmlinuz-2.6.22.17.tex2 BOOT_IMAGE=2.6.22.17.tex2 root=/dev/sda5 acpi=on resume=/dev/sda6 splash=silent vga=773
initrd (hd0,4)/boot/initrd-2.6.22.17.tex2.img
Thanks again for your help

ros
 
Old 08-21-2008, 09:31 AM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
As you know, when the system boots it loads the Master Boot Record (MBR) as the first step. The MBR "points to" the boot-loader, which, in turn, loads the operating-system.

(Usually the first thing that the boot-loader does is show you a pretty picture so that you don't notice all those ugly messages flying by... Every OS does this.)

Anyhow: when you reinstall Windows, it will (of course) install its own loader and replace the MBR to point to it. You will need to reverse that process:
  1. Boot a rescue-CD.
  2. Verify that the partitions (Windows and otherwise) are correctly set.
  3. Verify that the grub control-files are set appropriately to allow you to boot various things.
  4. Run grub-install to update the MBR to point (back) to grub.
Now, when you boot the system, grub will run first. From the menu that it presents, you can select Linux or Windows.

When you select "Windows," grub must be set-up to hand control over to Windows' boot-loader... and to do so in exactly the same way that the MBR would have done, so that Windows continues to believe that "no one was here before me." This is well-documented in the grub materials.

Have your rescue-CD nearby and know how to use it. Of course, the best way to do that is... practice ahead of time.
 
Old 08-25-2008, 05:14 AM   #10
Quercus ruber
Member
 
Registered: Mar 2004
Location: Bocholt, Germany
Distribution: Slackware
Posts: 135

Original Poster
Rep: Reputation: 24
Unhappy

Hi

well, my joy was short lived and perhaps the problem is no longer appropriate for lq; perhaps vista questions would be better. It was my mistake. I thought that because I'd recovered once, the solution was reproducable. But it wasn't. I've just looked and I haven't listed my partitions yet. Well, here they are:
Code:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xc5802db7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1530    12288000   27  Unknown
/dev/sda2            1531        7308    46411785    7  HPFS/NTFS
/dev/sda3           16506       17996    11976457+   7  HPFS/NTFS
/dev/sda4            7309       16505    73874902+   5  Extended
/dev/sda5            7309        8327     8185086   83  Linux
/dev/sda6            8328        8836     4088511   82  Linux swap / Solaris
/dev/sda7           13875       16505    21133476   83  Linux
/dev/sda8            8837       10206    11004493+  83  Linux
/dev/sda9           12437       13874    11550703+  83  Linux
/dev/sda10          10207       12436    17912443+  83  Linux

Partition table entries are not in disk order
I shrunk sda3 (that's the one with the label DATA, which has never been used) last week with vista, after I'd recovered it (vista), and then on Saturday I moved it (sda3) with Gparted, creating some empty space after my extended partition, which I then extended further. Then I rebooted to vista and had the by now familiar blank screen. So I confidently reset my bios to default values and booted with the system rescue disk provided by fujitsu-siemens, but I just got the windows wallpaper and a movable pointer, nothing else. I looked around and downloaded a windows-vista-recovery-disk from neosmart.net, which booted, copied files (according to a message on the screen), displayed a vista wallpaper and a mouse pointer which I could move, but that was it. No response from the keyboard, no options, nix. I looked further and as far as I can make out, my partition table might be damaged and I should use testdisk. I'm very nervous about it. If I delete a linux install, which I have done more often than I'd like to admit, I could always do a reinstall, but what happens if I wipe vista? These recovery disk things must do something which isn't independent of what's on the disk. I have a licence. The number is under the laptop. Oh vista,I hate it!

Out of interest, I reshrunk my extended partition to where it now is and re-moved sda3 with gparted, but the latter operation produced an error:

[HTML]GParted 0.3.4

Libparted 1.7.1


Delete Logical Partition (ext3, 11.19 GB) from /dev/sda 00:01 ( SUCCES )

calibrate /dev/sda11 00:01 ( SUCCES )

path: /dev/sda11
start: 265152888
end: 288623789
size: 23470902 (11.19 GB)
delete partition 00:00 ( SUCCES )

========================================


Shrink /dev/sda4 from 81.64 GB to 70.45 GB 00:01 ( SUCCES )

calibrate /dev/sda4 00:00 ( SUCCES )

path: /dev/sda4
start: 117403020
end: 288623789
size: 171220770 (81.64 GB)
calculate new size and position of /dev/sda4 00:00 ( SUCCES )

requested start: 117403020
requested end: 265152824
requested size: 147749805 (70.45 GB)
new start: 117403020
new end: 265152824
new size: 147749805 (70.45 GB)
shrink partition from 81.64 GB to 70.45 GB 00:01 ( SUCCES )

old start: 117403020
old end: 288623789
old size: 171220770 (81.64 GB)
new start: 117403020
new end: 265152824
new size: 147749805 (70.45 GB)

========================================


Move /dev/sda3 to the left 49:49 ( ERROR )

calibrate /dev/sda3 00:00 ( SUCCES )

path: /dev/sda3
start: 288623790
end: 312576704
size: 23952915 (11.42 GB)
calculate new size and position of /dev/sda3 00:00 ( SUCCES )

requested start: 265152825
requested end: 289105739
requested size: 23952915 (11.42 GB)
new start: 265152825
new end: 289105739
new size: 23952915 (11.42 GB)
check filesystem on /dev/sda3 for errors and (if possible) fix them 00:00 ( SUCCES )

ntfsresize -P -i -f -v /dev/sda3

ntfsresize v1.13.1.1 (libntfs 9:0:0)
Device name : /dev/sda3
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 12263887360 bytes (12264 MB)
Current device size: 12263892480 bytes (12264 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 91 MB (0.7%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
$MFT : 1 MB 0
$MFTMirr : 12141 MB 1
Ordinary : 12208 MB 2
You might resize at 90103808 bytes or 91 MB (freeing 12173 MB).
Please make a test run using both the -n and -s options before real resizing!

move partition to the left 00:01 ( SUCCES )

old start: 288623790
old end: 312576704
old size: 23952915 (11.42 GB)
new start: 265152825
new end: 289105739
new size: 23952915 (11.42 GB)
move filesystem to the left 49:48 ( SUCCES )

perform readonly test 08:00 ( SUCCES )

using internal algorithm
read 23952915 sectors
finding optimal blocksize

read 32768 sectors using a blocksize of 128 sectors 00:00 ( SUCCES )

32768 of 32768 read
0.594235 seconds
read 32768 sectors using a blocksize of 256 sectors 00:01 ( SUCCES )

32768 of 32768 read
0.55676 seconds
read 32768 sectors using a blocksize of 512 sectors 00:00 ( SUCCES )

32768 of 32768 read
0.599035 seconds
optimal blocksize is 256 sectors (128.00 KB)
read 23854611 sectors using a blocksize of 256 sectors 07:59 ( SUCCES )

23854611 of 23854611 read
23952915 sectors read
perform real move 41:48 ( SUCCES )

using internal algorithm
copy 23952915 sectors
finding optimal blocksize

copy 32768 sectors using a blocksize of 64 sectors 00:03 ( SUCCES )

32768 of 32768 copied
3.19884 seconds
copy 32768 sectors using a blocksize of 128 sectors 00:03 ( SUCCES )

32768 of 32768 copied
3.16689 seconds
copy 32768 sectors using a blocksize of 256 sectors 00:06 ( SUCCES )

32768 of 32768 copied
5.15375 seconds
optimal blocksize is 128 sectors (64.00 KB)
copy 23854611 sectors using a blocksize of 128 sectors 41:36 ( SUCCES )

23854611 of 23854611 copied
23952915 sectors copied
updating bootsector of ntfs filesystem on /dev/sda3 00:00 ( SUCCES )

echo 39e9cd0f | /usr/bin/xxd -r -p | /bin/dd conv=notrunc of=/dev/sda3 bs=1 seek=28

4+0 records in
4+0 records out
4 bytes (4 B) copied, 0.0035971 s, 1.1 kB/s

check filesystem on /dev/sda3 for errors and (if possible) fix them 00:00 ( SUCCES )

ntfsresize -P -i -f -v /dev/sda3

ntfsresize v1.13.1.1 (libntfs 9:0:0)
Device name : /dev/sda3
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 12263887360 bytes (12264 MB)
Current device size: 12263892480 bytes (12264 MB)
Checking for bad sectors ...
Checking filesystem consistency ...
Accounting clusters ...
Space in use : 91 MB (0.7%)
Collecting resizing constraints ...
Estimating smallest shrunken size supported ...
File feature Last used at By inode
$MFT : 1 MB 0
$MFTMirr : 12141 MB 1
Ordinary : 12208 MB 2
You might resize at 90103808 bytes or 91 MB (freeing 12173 MB).
Please make a test run using both the -n and -s options before real resizing!

grow filesystem to fill the partition 00:00 ( ERROR )

run simulation 00:00 ( SUCCES )

ntfsresize -P --force --force /dev/sda3 --no-action

ntfsresize v1.13.1.1 (libntfs 9:0:0)
Device name : /dev/sda3
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 12263887360 bytes (12264 MB)
Current device size: 12263892480 bytes (12264 MB)
New volume size : 12263887360 bytes (12264 MB)
Nothing to do: NTFS volume size is already OK.

real resize 00:00 ( ERROR )

ntfsresize -P --force --force /dev/sda3

ntfsresize v1.13.1.1 (libntfs 9:0:0)
ERROR(95): Opening '/dev/sda3' as NTFS failed: Operation not supported
The NTFS journal file is unclean. Please shutdown Windows properly before
using this software! Note, if you have run chkdsk previously then boot
Windows again which will automatically initialize the journal correctly.


========================================[/HTML]

any help would be very much appreciated. Really appreciated.

ros
 
Old 08-27-2008, 06:18 AM   #11
Quercus ruber
Member
 
Registered: Mar 2004
Location: Bocholt, Germany
Distribution: Slackware
Posts: 135

Original Poster
Rep: Reputation: 24
Thumbs up Solved! (again)

Hi

I'm so relieved. I've solved my problem with no reinstalls or anything nasty. I read this page
http://www.howtogeek.com/howto/windo...sta-partition/

and all the comments and followed most of the links as well, and ended

up booting my system rescue disk with the live gparted and so forth.
My bad partition from vista's viewpoint was sda3, so I ran this command:
ntfsfix /dev/sda3

booted into vista, where it did a disk check and all was well. There was one small problem: sda7 (my /home partition) and sda9 had disappeared, but as I had only backed them up on Thursday, I recovered them with no problems.

Man I feel so relieved! Thanks for all your help folks. I hope my solution can help somebody else out there.

Ros
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Windows, IE lose web share to Mac OS X, Linux, Safari, Firefox, iPhone LXer Syndicated Linux News 0 06-02-2008 06:51 PM
reinstall windows without removing linux Thiyagaraj Linux - Newbie 5 04-10-2008 07:04 PM
Reinstall Windows in Windows/Linux Dual Boot aye29 Linux - General 5 07-27-2006 08:48 AM
Need to reinstall a windows file through linux... rrfish72 Linux - General 4 12-18-2004 11:49 AM
Need to reinstall windows from linux.... Z28kid Linux - Newbie 10 07-14-2003 11:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration