Formatting a external hard drive

Hey there everyone. I’m a new guy trying OpenSuse 11.4.

What I’ve done is partition my external hard drive to have 130g for my Windows info. Then putting the 90g towards Linux. I used a live cd on my home computer to format the 90g of Linux. I’m simply wanting something to learn more about from time to time that I can use on my home computer, laptop, fiance’s computer, etc. So the formatting went successful. I have linux on the 90g of hard drive that I wanted it on.

The problem is this. When I take the live cd out, when I remove my external hard drive from my computer. The home computer (which has Windows) won’t boot. It comes up with a error 21. But now when I boot with the external hard drive I use, I make it to the boot menu and can boot from Windows.

I need to be able to boot from Windows on this home computer, since my mother and grandparents use this computer quite a bit. I’m not always going to have my ext. hard drive plugged into this computer, so I need some help if you all know now.

Finally, is it safe to plug this into my laptop? Or should I wait?

Thanks again everyone. I appreciate it.

Taylor

Hey there everyone. I’m a new guy trying OpenSuse 11.4.

What I’ve done is partition my external hard drive to have 130g for my Windows info. Then putting the 90g towards Linux. I used a live cd on my home computer to format the 90g of Linux. I’m simply wanting something to learn more about from time to time that I can use on my home computer, laptop, fiance’s computer, etc. So the formatting went successful. I have linux on the 90g of hard drive that I wanted it on.

The problem is this. When I take the live cd out, when I remove my external hard drive from my computer. The home computer (which has Windows) won’t boot. It comes up with a error 21. But now when I boot with the external hard drive I use, I make it to the boot menu and can boot from Windows.

I need to be able to boot from Windows on this home computer, since my mother and grandparents use this computer quite a bit. I’m not always going to have my ext. hard drive plugged into this computer, so I need some help if you all know now.

Finally, is it safe to plug this into my laptop? Or should I wait?

Thanks again everyone. I appreciate it.

Taylor
It sounds like you installed the Grub boot loader on your Windows hard drive and not the external drive. First off, using an external drive and internal is OK and does not need to be fixed as long as Windows and openSUSE work. If you are bent on returning the internal drive back to normal, you most likely must use your Windows boot disk to repair your Windows installation by restoring the MBR (Master Boot Record) to its original Windows boot setup and perhaps set the (correct) Windows partition as active for booting. Doing this will stop openSUSE from loading properly. While you contemplate what I have said, here are some partitioning facts to think about.

Each hard drive can have up to four PRIMARY partitions, any of which could be marked active and bootable. No matter what you might hear, only one of the first four primary partitions can be booted from. That means you can boot from Primary partitions 1, 2, 3 or 4 and that is all. In order to boot openSUSE, you must load openSUSE and the grub boot loader into one of the first four partitions. Or, your second choice is to load the grub boot loader into the MBR (Master Boot Record) at the start of the disk. The MBR can be blank, like a new disk, it can contain a Windows partition booting code or generic booting code to boot the active partition 1, 2, 3, or 4. Or, as stated before, it can contain the grub boot loader. Why load grub into the MBR then? You do this so that you can “boot” openSUSE from a logical partition, numbered 5 or higher, which is not normally possible. In order to have more than four partitions, one of them (and only one can be assigned as extended) must be a extended partition. It is called an Extended Primary Partition, a container partition, it can be any one of the first four and it can contain one or more logical partitions within. Anytime you see partition numbers 5, 6 or higher for instance, they can only occur inside of the one and only Extended Primary partition you could have.

What does openSUSE want as far as partitions? It needs at minimum a SWAP partition and a “/” partition where all of your software is loaded. Further, it is recommended you create a separate /home partition, which makes it easier to upgrade or reload openSUSE without losing all of your settings. So, that is three more partitions you must add to what you have now. What must you do to load and boot openSUSE from an external hard drive? Number one, you must be able to select your external hard drive as the boot drive in your BIOS setup. Number two, you need to make sure that the external hard drive, perhaps /dev/sdb, is listed as the first hard drive in your grub device.map file and listed as drive hd0. I always suggest that you do not load grub into the MBR, but rather into the openSUSE “/” root primary partition which means a primary number of 1, 2, 3 or 4. If number one is used, then that will be out. You will mark the openSUSE partition as active for booting and finally you must load generic booting code into the MBR so that it will boot the openSUSE partition. I suggest a partition like this:

  1. /dev/sdb, Load MBR with generic booting code
  2. /dev/sdb1, Primary NTFS Partition for Windows
  3. /dev/sdb2, Primary SWAP (4 GB)
  4. /dev/sdb3, Primary EXT4 “/” openSUSE Partition Marked Active for booting (80-120 GB)
  5. /dev/sdb4, Primary EXT4 “/home” Your main home directory (Rest of the disk)

Thank You,

Hmmm, I gotcha. Well here’s the problem. I don’t have a Vista boot disc for Windows. Am I in a rut or is there another way? Thanks for the help so far.

Taylor

Hmmm, I gotcha. Well here’s the problem. I don’t have a Vista boot disc for Windows. Am I in a rut or is there another way? Thanks for the help so far.

Taylor
I think you may be in a pickle without an original Windows boot disk. I suggest you consider it time to upgrade to Windows 7 or find a friend that can lend you their Windows Vista disk. You may be able to find a repair program online for $50 or so but without that friend, you need to stick with what you got or spend some more money, in my opinion.

Thank You,

You just need to write a generic boot code to the MBR of your internal disk.
Look in YaST → Boot Loader → Boot Loader Installation → Boot Loader Options … and see if it does rewrite a generic boot code on your internal drive (It would during setup). But don’t do it if you’re unsure! You should not install Grub anywhere on your Windows disk.

Or use ms-sys](http://ms-sys.sourceforge.net/) to write a Vista MBR. (this tool is not part of any Linux distro for obvious reasons. It used to be shipped with Debian/Ubuntu though).

In both cases, you need to set the bootflag on your Windows partition before rebooting.

So I gotcha. So I need to pull up OpenSuse and go under YaST and do the following. Or do the other option. How would I set the bootflag to Windows? I’m deeply confused. I’ve been a Windows person for a long time, I’m not a novice in computers, but I am a novice in the BIOS and Linux.

Thanks so far for the help. I appreciate everything.

Taylor

So I gotcha. So I need to pull up OpenSuse and go under YaST and do the following. Or do the other option. How would I set the bootflag to Windows? I’m deeply confused. I’ve been a Windows person for a long time, I’m not a novice in computers, but I am a novice in the BIOS and Linux.

Thanks so far for the help. I appreciate everything.

Taylor
If you decide to reinstall openSUSE onto your Windows drive (you will need to make room for it), you could elect to write a generic MBR in the openSUSE installation. openSUSE will not give you a choice to set the Windows partition as active, but actually the Windows partitioning program will allow you to set the Windows partition as active for booting in Windows. Be careful as Windows 7 tends to create two partitions, one small one that actually boots and one large, for the rest of Windows which you do not boot, and so it is not set active for booting.

Be careful as every time you install/reinstall Windows or openSUSE, when you are not real experience at doing this, you can mess up again. Do your home work and know what you need to do before you try to do it and good luck.

Thank You,

Again, I’m not sure that YaST will write a generic boot code without reinstalling. I’ve never done that. In fact, I never used generic bootcode at all (but I don’t use Windows either, which makes things much easier). It will write a generic boot code for sure while installing and it even does that by default (to my dismay!)
As for setting the bootflag, there are many ways to do it. You’ll first have to type

fdisk -l

to see which partition has the bootflag (indicated by a star).
Then you can use fdisk, cfdisk or sfdisk under Linux as well as the command **diskpart **under Windows. All these commands are to be issued in a terminal and as root under Linux or administrator under Windows. Several GUI partitioning tools (like gparted available on Ubuntu live CD and Parted Magic live system) also allow you to set the bootflag.

You can see an example with fdisk in this post: Invalid partition table - parted magic 5.8 - grub - Page 4, and an explanation about WIndows diskpart here: Windows and openSuse 11.4 dual boot problem - Page 5

To set the bootflag on the first primary partition on the first hard disk with sfdisk, you’ll just type the following:

su -c '/sbin/sfdisk -A1 /dev/sda'

The big difference between sfdisk and **fdisk/cfdisk **is that sfdisk toggles the bootflag (set it on a partition and unset it on the other) while fdisk/cfdisk just set or unset the bootflag on a single partition (so you have to use two commands).

You have to find out which Windows partition you need to activate. If you set the bootflag on the wrong partition and have generic boot code in MBR, nothing will boot anymore. As mentionned earlier, Windows 7 uses more than one partition.

For the record (not what you want here), ** [findgrub](http://forums.opensuse.org/english/other-forums/development/programming-scripting/447138-looking-grub-windows-bootloader-all-partitions-8.html#post2325904) -a **and **[updategrub](http://forums.opensuse.org/english/get-technical-help-here/how-faq-forums/advanced-how-faq-read-only/458238-updategrub-opensuse-legacy-grub-not-update-grub.html#post2329167) -a** can set the bootflag on the Grub (primary or extended) partition (findgrub will ask for confirmation, updategrub won't).

Gotcha gotcha. Is there anyway for me to remove Grub boot and remove OpenSuse completely for now and redo it the right way? Since I put it on my external hard drive and only used my desktop as a medium to get the OS on the external hard drive, would that work?

Haha I appreciate all the help. Grandparents and Mom are getting a little ancy wanting the computer to get fixed, I’m just wanting to do this the right way this time.

Again thanks for the patience and help.

Taylor_F

The Grub bootloader in the bootsector of your extended partition doesn’t bother anyone. As soon as this partition doesn’t have the bootflag, it won’t boot. It is safe to leave it there and definitely the better option if you’re not familiar with bootsectors.

On 2011-06-14 06:06, please try again wrote:

> Again, I’m not sure that YaST will write a generic boot code without
> reinstalling.

Yes, it will write all if you change anything. A typical trick to force
reinstallation of grub was to change the “timeout” value in yast.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

Okie dokie. I’ve been messing around with changing the boot flag and I’ve been trying to figure it out haha. Me being a noob I’m afraid I may mess something up.

But I looked into YaST and I seen the internal hard drive that’s in my desktop. It’s set to /dev/sdf1.

I’m not sure what I have to do to get this right. But again, thanks for your patience. Just a nooby your dealing with here, nothing more haha.

Thanks everyone.

Taylor

Hey everyone. With the information I posted last, does anyone have an idea of where I need to go next or what I need to do?

Thanks,
Taylor

In a previous message, a request was made for the output from a fdisk -l command. Open up a terminal session and enter the following commands:

su -
password:
fdisk -l

You will not type in the word password:, but rather respond to the password request by entering the root user password. Once complete, use your mouse to highlight and then copy (right click of your mouse) the output from the terminal session commands above and then post it here in a forum message. I normally suggest you go into the advance message editor, select the text you just posted from your terminal session and press the code # button. That makes it show up like the commands I posted above.

Thank You,

Ahhh gotcha. Thanks for showing me that. I never would’ve seen it.

Here’s what I get once I put in fdisk -1 as superuser.

linux-6zfw:~ # fdisk -1
fdisk: invalid option -- '1'
Usage:
 fdisk [options] <disk>    change partition table
 fdisk [options] -l <disk> list partition table(s)
 fdisk -s <partition>      give partition size(s) in blocks

Options:
 -b <size>             sector size (512, 1024, 2048 or 4096)
 -c=<mode>]           compatible mode: 'dos' or 'nondos' (default)
 -h                    print this help text
 -u=<unit>]           display units: 'cylinders' or 'sectors' (default)
 -v                    print program version
 -C <number>           specify the number of cylinders
 -H <number>           specify the number of heads
 -S <number>           specify the number of sectors per track 

This is a lower case L, not 1.

Haha good point. Sorry about that.

here it is.

linux-6zfw:~ # fdisk -l

Disk /dev/sda: 250.1 GB, 250059349504 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397167 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa4b57300

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63   283592064   141796001    7  HPFS/NTFS/exFAT
/dev/sda2       283592704   488396799   102402048    f  W95 Ext'd (LBA)
/dev/sda5       283594752   287805439     2105344   82  Linux swap / Solaris
/dev/sda6       287807488   329750527    20971520   83  Linux
/dev/sda7       329752576   488376319    79311872   83  Linux

Disk /dev/sdf: 320.1 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b9a6f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdf1   *        2048   625139711   312568832    7  HPFS/NTFS/exFAT

On 2011-06-20 02:36, taylor f wrote:
>
> Ahhh gotcha. Thanks for showing me that. I never would’ve seen it.
>
> Here’s what I get once I put in fdisk -1 as superuser.
>
>
> Code:
> --------------------
> linux-6zfw:~ # fdisk -1
> fdisk: invalid option – ‘1’
> Usage:
> fdisk [options] <disk> change partition table

That’s lower case L, not the number one. Attention to detail is important.


Cheers / Saludos,

Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)

I gotcha. Does that last post make more sense?

Now when you turn off your computer, unplug your external HD and reboot, what do you see? If you see a Grub error message, you need to rewrite a generic bootcode to your internal disk’s MBR. The fact that your internal disk appears as sdf in Linux is a little bit weird but irrelevant to boot Windows.