LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't boot after empty primary partition was made unallocated (https://www.linuxquestions.org/questions/linux-newbie-8/cant-boot-after-empty-primary-partition-was-made-unallocated-808018/)

Azazwa 05-15-2010 10:53 AM

Can't boot after empty primary partition was made unallocated
 
Hi!

On a certain computer, I had four primary partitions. The person who installed the Windows 7 on the computer made two partitions for the Windows (sda1 and sda2). Then I made another two primary partitions (sda3 and sda4). sda3 was empty. sda4 is an extended partition that contained the /swap, and / .
According to someone else, some viruses get in on the Windows partitions and can then get over to the Linux partitions if they are primary and right after the Windows partitions, or something like that. This person suggested that I create sda3 when I install Linux(SLES 10), but to install Linux on sda4. Then later I can change sda3 to secondary.
So I tried this, and the Linux installation went fine.
I decided to change sda3 before I load the application software onto the computer.
So I put the GParted CD in, but to my surprise I realised that the harddisk was actually 1 TB, and not 500 GB as I thought. So I had extra space to the right of sda4. I wasn't quite sure what to do with sda3. I thought that perhaps it would be better to unallocate sda3, move the current sda4 to the left, and then make another primary partition on the right of sda4, or just stretch sda4 both ways.

Anycase, I unallocated sda3, and just left sda4 as it was.

Hm, perhaps you can anticipate the end of the story. I removed the GParted CD, and restarted the computer, but now the computer doesn't let me choose whether I want to boot into Linux or Windows. Um, it doesn't boot at all from the harddisk.

I know it's dangerous to play with partitions, but sometimes the job won't be done if you are too afraid of doing anything, and I dare say you won't learn anything either. There was nothing on sda3, so I didn't think it would have nasty after effects. There isn't any important data on this computer yet, it was two new installations of Windows and Linux. So I guess I could format the harddisk and just reinstall everything, but I would like to learn what goes on underneath the surface.

Why did this happen?
Can it be fixed?
How?
If I am in the same situation one day, how do I make sda3 secondary without making the same mistake?

thecarpy 05-15-2010 01:11 PM

It looks like the boot record was flashed. Which partition was active? I suppose the one you wiped. You also most likely installed grub into the boot record of that partition, and not into the mbr.
So, the easy solution is to boot from a linux livecd and reinstall grub, this time, make sure it ends up in the mbr.

BTW, partition-related viruses are out of fashion, they were ten years ago and I have heard only of hoaxes since. I used to work in the anti-virus industry ... ;-)

pixellany 05-15-2010 01:14 PM

Quote:

According to someone else, some viruses get in on the Windows partitions and can then get over to the Linux partitions if they are primary and right after the Windows partitions, or something like that. This person suggested that I create sda3 when I install Linux(SLES 10), but to install Linux on sda4. Then later I can change sda3 to secondary.
That person has no idea what they are talking about....

1. Windows viruses are not going to magically migrate over to Linux---no matter what kind of partitions are used.

2. Linux does not care about primary vs. logical partitions. (logical is the common name for what you are calling "secondary")

What may have happened here was that the config. file for the Linux bootloader was on the partition that you deleted.

Before doing anything else, we need to confirm what is on the disk. Boot up from an Linux Live CD (eg the one you used to install Linux), open a terminal, and run "fdisk -l". This must be run as root---or in Ubuntu, it would be "sudo fdisk -l".
Post the results here.

vigi 05-15-2010 01:30 PM

When using gparted with windows ntfs partitions especially, you need to defragment it first in windows, and reboot into windows (or the system you are changing) to update its partition table. The changes you make with an external application may not be automatically detected by the altered operating system.

thecarpy 05-15-2010 01:55 PM

he claimed the partition was empty, lets hope he has not deleted linux, by mistake ;-).

Theoretically, boot record viri can spread, but last time I saw one in the wild it was on a floppy, then on my HD ;-) in 1998. I worked for anti-virus firm in beginning of the year 2000, none reported there, iirc.

Azazwa 06-09-2010 02:44 AM

Hi!

I am sorry that I was silent for so long (you must have thought that I am terribly rude), but more urgent matters had to be attended to.

So here is the output of fdisk -l:
Code:

root@debian:~# fdisk –l

Disk /dev/sda: 1000.2 GB, 1000204886015 bytes
255 heads, 63 sectors/track 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x940ba7b2

Device                Boot        Start        End        Blocks                Id        System
/dev/sda1                1        13        102400        7        HPFS/NTFS
Partition 1 does not end on cylinder boundary
/dev/sda2                14        13144        105474754+        7        HPFS/NTFS
/dev/sda3                13144 26199        104864287+        83        Linux
/dev/sda4        *        26200 65362        314576797+        f        W95 Ext’d (LBA)
/dev/sda5                26200        27505        10490413+        82        Linux swap / Solaris
/dev/sda6                27506        32727        41945683+        83        Linux
/dev/sda7                32728        39255        52436128+        83        Linux
/dev/sda8                39256        65362        209704446        83        Linux

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x01bd0565

Device                Boot        Start        End                Blocks                Id        System
/dev/sdb1                1        121601        976760001        f        W95 Ext’d (LBA)
/dev/sdb5                1        121601        976759969+        83        Linux

I'll read up about grub.
Thanks for your help!

hilyard 06-09-2010 01:04 PM

/dev/sda3 was your /boot partition - looks like you get to hand-write grub
Good reading & come back!

saikee 06-09-2010 02:31 PM

Reading the OP Post #1 and Post #6 I found

(1) The OP doesn't know there cannot be more than 4 primaries in a disk that use Msdos, as against gp, partition table.

(2) The OP did not unallocate the sda3 if that was done may be it was done on second disk sdb3 but then sdb has no primary at all and all the cylinders are used up.

(3) Both disk have been partitioned with an extended partition.

(4) The OP has achieved a feat after marking an extended partition "bootable". Even without being marked with a "*" an extended partition has never able to boot in PC history as it has no storage of its own.

(5) The Windows, if has not been damaed, can be fired manually up by a Grub prompt, from either a Grub floppy or a Live CD that uses Grub, with commands
Code:

root (hd0,0)
makeactive
chainloader +1

or
Code:

root (hd0,1)
makeactive
chainloader +1

(6) The Linux can be fired up in a Grub1 prompt by commands
Code:

root (hd0,2)
configfile /boot/grub/menu.lst

or in Grub2 prompt
Code:

set root=(hd0,3)
configfile /boot/grub/grub.cfg

I highlight the different syntax in red between Grub1 and Grub2.

Once Linux has been booted put Grub in the MBR of disk sda (applicable to both Grub1 and Grub2) by
Code:

grub-install /dev/sda
(7) Technically Grub1 or Grub2 can be asked to boot a non-existent partition. It just returns with nothing.

Azazwa 06-17-2010 08:44 AM

Hi!

Thanks for everyone's help so far.

I put the SuSE installation CD in, and used the Rescue installation option. Then as root I typed "grub".
On this site: http://www.justlinux.com/forum/showthread.php?t=143973 it explains that there is a difference between the Grub shell and the Grub prompt. I guess the above command gives the Grub shell. (Am I correct?)

With the commands given by saikee above, I found that I had Grub1, since what he gave for Grub2 didn't produce a favourable response from the computer. ;-)

I didn't manage to fire up the Linux or the Windows (perhaps because I was using the shell and not the prompt?).
Anycase, I used
Code:

find /boot/grub/stage1
and used whatever the computer spat back (hd0,x)for
Code:

root (hd0,x)
setup (hd0)

I quit the grub shell and restarted the computer, and everything seems fine.

According to this site:https://help.ubuntu.com/community/GrubHowto it seems that with
Code:

setup (hd0)
I already have grub installed to the MBR. Is this correct?
I tried the following after I had logged in to Linux:
Code:

linux-x77x:~ # grub-install /dev/sda
/dev/sda does not have any corresponding BIOS drive.

Um, so I'm still confused.

The links given at the bottom of the contributing posters' posts have been very helpful and I will read more when I have time to do so.

In my previous post I copied the output of fdisk -l by hand, and it is possible that a few mistakes slipped in, so I guess that explains the remarkable feat.
The following is the current output of fdisk -l (not hand-copied)

Code:

linux-x77x:~ # fdisk -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          1          13      102400    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2              14      13144  105474757+  7  HPFS/NTFS
/dev/sda3          13145      26199  104864287+  83  Linux
/dev/sda4          26200      65362  314576797+  f  W95 Ext'd (LBA)
/dev/sda5          26200      27505    10490413+  82  Linux swap / Solaris
/dev/sda6          27506      32727    41945683+  83  Linux
/dev/sda7          32728      39255    52436128+  83  Linux
/dev/sda8          39256      65362  209704446  83  Linux

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              1      121601  976760001    f  W95 Ext'd (LBA)
/dev/sdb5              1      121601  976759969+  83  Linux

Your comments will be appreciated...

;-)


All times are GMT -5. The time now is 10:59 PM.