# ubuntu grub boot



## sonic47 (Mar 8, 2007)

I will start with the history i hve winxp on a 200 gb drive which i added a dual boot ubuntu 10.about a week ago, but today i edited one of 3 the Partitions but when i rebooted i got a message saying " unknown file system" "Grub rescue", i then tried to reinstall on top of the ubuntu but ended up with another Installation of ubuntu , so i tried to open winxp with the Installation disk but got the same message so the only way i can get into my pc is to boot with the live cd if any one can help i am very desperate Help please


----------



## TerryNet (Mar 23, 2005)

When booted into the Live CD in a Terminal window type

sudo fdisk -l

and show us the results. That last letter is a lower case L. When you are prompted for a password just hit Enter.

The results should give us a picture of what is on the hard drive now.


----------



## sonic47 (Mar 8, 2007)

Thanks for the speedy reply , I followed your instructions but now i have keyboard problem when i type the lower case L i get a back to front J , My gerneric keyboard is a french as i live in france so i get a result saying " command not found " , if it helps my 200gb drive is as follows 1 winxp NTFS 85GB
2 Extended partition 65GB
HPFS/ NTFS 20 GB 
Linux 33GB
Linux 6GB
linux Swap 327 MB
linux Swap 1.7 GB
3 HPFS/NTFS 54GB
I hope this helps Andrew.


----------



## saikee (Jun 11, 2004)

A boot loader like Grub resides in the MBR, which is only 512 byes large, and need to get back to the Ubuntu partition to get its intelligence.

If you have "edited" the partition as claimed then you might have moved the boundary, added, or deleted the boundaries causing Grub no longer able to find its own files.

Grub can boot Xp if it is told which the partition has it. 

Apparently you have 4 NTFS partitions but do you know which one in Linux convention? How about which is your 1st and 2nd Ubuntu? or is there one currently usable?

Your information is confusing as we do not know if your 2nd Ubuntu operational or not. You made it as though it isn't but you claimed it was on top of the first but ending up as another. 

If you have no operating system bootable then please provide the information requested by TerryNet by using the Live Ubuntu CD which must work if you managed to install Ubuntu twice with it


----------



## sonic47 (Mar 8, 2007)

Hi Saikee thanks for the reply I understand now that you should update grub after you edit the drive but as i am new to linux was not to know, second i have a outline of the drive from disk utility and " WINXP 85GB NTFS " resides in the first partition , The 1st ubuntu 33GB instalation resides in the 2nd partition of the extended partition and the second instalation of ubuntu resides in the 3rd the patitions marked HPFST/NTFS are empty un used left over from moveing all my files to another HDD drive leaving just WINXP , i cannot boot to any operating system yes i did try to reinstall ubuntu on top of the 1st but ended up with 2 , I tried to do as terrynet suggested but as you can read my reply to terrynet the L key in lower case is a problem linux is very diffarant to windows so am a complete newby so instructions have to be very simple but i will try to sort the key board problem thanks again Andrew.


----------



## sonic47 (Mar 8, 2007)

sonic47 said:


> Hi Saikee thanks for the reply I understand now that you should update grub after you edit the drive but as i am new to linux was not to know, second i have a outline of the drive from disk utility and " WINXP 85GB NTFS " resides in the first partition , The 1st ubuntu 33GB instalation resides in the 2nd partition of the extended partition and the second instalation of ubuntu resides in the 3rd the patitions marked HPFST/NTFS are empty un used left over from moveing all my files to another HDD drive leaving just WINXP , i cannot boot to any operating system yes i did try to reinstall ubuntu on top of the 1st but ended up with 2 , I tried to do as terrynet suggested but as you can read my reply to terrynet the L key in lower case is a problem linux is very diffarant to windows so am a complete newby so instructions have to be very simple but i will try to sort the key board problem , If at the end all fails i am not able to sort my problems i will perhaps clean the drive and start again but i am not looking forward to installinig windows again and linux but i donot know how to boot the windows CD and it takes so long thanks again Andrew.


----------



## TerryNet (Mar 23, 2005)

Not sure what else to suggest. The information you gave about your partitions may not still be an accurate picture, and it leaves out any important clues about why nothing will boot. I suggested the fdisk -l because I was sure that saikee would have the simplest solution if he saw that info.

If the XP installation is still intact you can probably get it to boot by following the instructions in XP: Repair or fix master boot record using recovery console.

Repairing a Broken GRUB 2 Boot-Loader on Ubuntu may also be helpful, but it seems far more complicated than simply repairing the MBR to boot to XP (which, even I have accomplished!).


----------



## sonic47 (Mar 8, 2007)

Hi terrynet i managed to get the info from fdisk as followsDisk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x039e3bb4

Device Boot Start End Blocks Id System
/dev/sda1 * 1 10315 82855206 7 HPFS/NTFS
/dev/sda2 10316 17709 59391644 f W95 Ext'd (LBA)
/dev/sda3 17742 24321 52853850 7 HPFS/NTFS
/dev/sda5 10316 12735 19432883 7 HPFS/NTFS
/dev/sda6 12735 16730 32092961 83 Linux
/dev/sda7 17500 17709 1684480 82 Linux swap / Solaris
/dev/sda8 16730 17460 5858304 83 Linux
/dev/sda9 17460 17499 319488 82 Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdb: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x62576257

Device Boot Start End Blocks Id System
/dev/sdb2 * 2 7297 58605120 f W95 Ext'd (LBA)
/dev/sdb5 2 2524 20265966 7 HPFS/NTFS
/dev/sdb6 2525 7297 38339091 7 HPFS/NTFS
[email protected]:~$ 

i hope you can make sense of it Andrew


----------



## TerryNet (Mar 23, 2005)

Well, we'll have to let saikee (or maybe another expert) make sense of it. With my limited knowledge and experience about all I can say is that the first partition includes the master boot record and, given it's size, maybe the XP installation; there are two Linux installations; and there are two Linux Swap, one twice the size of the other.

Have you tried to repair the XP boot with the instructions in the above link? I know that's only a small part of the problem, but it at least would give you one bootable OS.


----------



## saikee (Jun 11, 2004)

Sorry I have been away.

Let's get this sorted.

The target is to get rid of Grub rescue as it can be used to boot but good for investigation.

Since there is a Ubuntu in either sda6 or sda8 shall try either. The step is to mount the Ubuntu partition first after booting to a Live CD, ideally using Ubuntu CD. You can then tell Grub to restore itself in the MBR.

Assuming you have boot up the Ubuntu Live CD, then click Application/Accessories/Terminal to get a terminal. You will then claim the root privilege first by "sudo su" as meshing around a boot loader is a system-related activity, create a mounting point sat in /mnt, mount either sda6 (or sda8 if sda6 fails) and issue the grub-install command available in Ubuntu LIve CD.

```
sudo su
mkdir /mnt/sda6
mount /dev/sda6 /mnt/sda6
grub-install --root-directory=/mnt/sda6 /dev/sda
```
The above instruct Grub residing in Live CD booted up Linux to obtain the source configuration file from sda6 and install itself in the MBR of sda.

Grub should then boot to a menu and not Grub rescue. If that is the case you can boot the systems up manually even if the Grub configuration file /boot/grub/grub.cfg inside sda6 doesn't work.

Grub, as all boot loaders, has a small head in the MBR and a big tail in the partition. The head normally has a hard disk address for its tail, like at which cylinder, which head and what sector. If someone has changes the partition boundary or order then the address is wrong and the head cannot find its tail. In such a case Grub rescue is issued by the Grub in the MBR as a polite warning.

Let us know if you get a Grub boot screen. You get a full Grub if you press the C key and a Grub prompt appears. There is no PC installed operating system that cannot be booted from a Grub prompt so try to get it as your next goal.


----------



## TRS-80 vet (Jun 18, 2005)

sonic47 said:


> Hi Saikee thanks for the reply I understand now that you should update grub after you edit the drive but as i am new to linux was not to know, second i have a outline of the drive from disk utility and " WINXP 85GB NTFS " resides in the first partition , The 1st ubuntu 33GB instalation resides in the 2nd partition of the extended partition and the second instalation of ubuntu resides in the 3rd the patitions marked HPFST/NTFS are empty un used left over from moveing all my files to another HDD drive leaving just WINXP , i cannot boot to any operating system yes i did try to reinstall ubuntu on top of the 1st but ended up with 2 , I tried to do as terrynet suggested but as you can read my reply to terrynet the L key in lower case is a problem linux is very diffarant to windows so am a complete newby so instructions have to be very simple but i will try to sort the key board problem , If at the end all fails i am not able to sort my problems i will perhaps clean the drive and start again but i am not looking forward to installinig windows again and linux but i donot know how to boot the windows CD and it takes so long thanks again Andrew.


What you've got here is a little hard to break down there, sonic - no offense, but if you can break up your paragraph a little, it will help you present the problem to us, and ALSO it will help you keep sorted out what YOU have going on, like Saikee's and T'Net's posts.

They should have you out of your problem by their information too, depending on exactly what you meant my 'edited' of your partition... Saikee (and 'Herman') are GRUB Masters of the world; I think most would agree.


----------



## saikee (Jun 11, 2004)

TRS-80 vet said:


> Saikee (and 'Herman') are GRUB Masters of the world; I think most would agree.


I came here to learn from others. No different from any member.


----------



## sonic47 (Mar 8, 2007)

Hi TRS thank you for your comment but i will give you a little history and try and explain, First i am 63 and have never been good at righting letters and my spelling is not very good either and i retired early with health problems to live in france 11 years ago with my wife who useally checks my emails to freinds, Ok now my problem started when i tryed to format partition 5 from NTFS to lunux format haveing been used to " partition magic" i thought it would be the same , hence the mess i am in , Right now i would like to get the 200GB HDD back with WINXP + ubuntu duel boot and format the rest of the drive to a 3rd partition to file storage, Then after that i would like to tryout " PCLINUX " distro as reviews say it is much like windows which browsing the linux sites looks right for me , I would like to say here that i do strugle to work in the terminal and are on a steep learning curve, I was only able to make progress in the terminal by " copy and paste " the commands from Terry and Saikee s replys i can only think my gernerc keyboard may be the problem, If this explains a little of my problems and explain a little more simple the commands in the terminal it would be most helpfull , i will now try to follow Saikee s last message Andrew.


----------



## sonic47 (Mar 8, 2007)

Hi TRS thank you for your comment but i will give you a little history and try and explain, First i am 63 and have never been good at righting letters and my spelling is not very good either and i retired early with health problems to live in france 11 years ago with my wife who useally checks my emails to freinds, Ok now my problem started when i tryed to format partition 5 from NTFS to lunux format haveing been used to " partition magic" i thought it would be the same , hence the mess i am in , Right now i would like to get the 200GB HDD back with WINXP + ubuntu duel boot and format the rest of the drive to a 3rd partition to file storage, Then after that i would like to tryout " PCLINUX " distro as reviews say it is much like windows which browsing the linux sites looks right for me , I would like to say here that i do strugle to work in the terminal and are on a steep learning curve, I was only able to make progress in the terminal by " copy and paste " the commands from Terry and Saikee s replys i can only think my gernerc keyboard may be the problem, If this explains a little of my problems and explain a little more simple the commands in the terminal it would be most helpfull , i will now try to follow Saikee s last message Andrew.


----------



## sonic47 (Mar 8, 2007)

Hello saikee i am in problem solved i coped and pasted the command into terminal and restarted and bingo i got the boot screen list with ubuntu and others and winxp i cannot thank you enough , I am going to give a few days to get more familiar with linux then try out PCLINUX distro , i would like to hear of any addvice you can give to formating partitions to linux prior to installing " pclinux ", yours thanks again Andrew.


----------



## saikee (Jun 11, 2004)

Depending what you want to do my advice are

(1) Never use Partition Magic as the older versions of it do not know about Linux partitions but claim they do. It will offer fixes which if followed can lead to hard disk corruptions. Many forum members show hard disk problems originated from this software. For Windows only it may be fine but it is a lightweight comparing with those in Linux. Every partitioning tool in Linux supports over 100 partition types. The best to use is cfdisk and then checking by fdisk. Both are terminal programs but these programs can teach you about partitioning.

(2) My suggestion to your partitioning

```
Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track,[COLOR="Olive"] 24321 cylinders[/COLOR]
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x039e3bb4

Device Boot Start End Blocks Id System, based on your assertion the NTFS partitions are empty and can be deleted
/dev/sda1 * 1 10315 82855206 7 HPFS/NTFS
[COLOR="Olive"]/dev/sda2 10316 17709 59391644 f W95 Ext'd (LBA)[/COLOR]
[COLOR="Red"]/dev/sda3 17742 24321 52853850 7 HPFS/NTFS[/COLOR]
/dev/sda5 10316 12735 19432883 7 HPFS/NTFS
/dev/sda6 12735 16730 32092961 83 Linux
/dev/sda7 17500 17709 1684480 82 Linux swap / Solaris
[COLOR="Red"]/dev/sda8 16730 17460 5858304 83 Linux
/dev/sda9 17460 17499 319488 82 Linux swap / Solaris[/COLOR]
```
I suggest you use a terminal to partition your hard disk sda by command

```
sudo su
cfdisk /dev/sda
```
Sudo su only needs to be issued once in each terminal to change you into a root user (= Admin in MS Windows).
You will see sda3 is at the end of sda9 according to the cylinder position. Basically you should look at the cylinder numbers from now on as you will not be able to understand partitions without them.

If you delete sda9, sda8, sda3 you hard disk will have all the empty space available below sda7. This arrangement allows you to continue to create logical partitions, which always start at the 5th position (as the first 4 are reserved primaries even if you do not use them and so your first logical partition is always sda5) to sda129. It is however safe to use no higher than sda15 as not all Linux programs have been written for partitions higher than 15.

You can install any MS Windows and Linux in the logical partitions now. Normally a MS Windows must start with a primary partition which you have already got in sda1. If you install say Vista and Win7 now both of them cam reside in the logical partitions (one each) happily and their installer will always put their respective boot loaders in sda1. As for Linux everyone can be booted anywhere from the hard disk so no need to worry about primary or logical.

In using cfdisk it will ask you if you want the partition to be primary or logical. Always use logical in your case for sda. This is because if you use a primary it will terminate your current extended partition immediately and change the space below it for the new primary. Nobody can have more than one extended partition in a hard disk and it is formed by giving up one of the 4 primaries. It is a bad arrangement to have primary partitions after an extended partition limiting the growth of the logical partitions. You cam experiment with cfdisk to check it out by different arrangements. The partition table will not be written until you click "write" and then confirm with a "yes" in cfdisk. Even after you have done that partitioning of a hard disk in completely reversible by using cfdisk to remove the partitions or revert back to the original partition table later. No harm is done until after you format the partitions and write on them.

With the exception of a few odd partitioning tools like Gparted (the equivalent to Partition Magic in Linux and downloadable in Ubuntu by command "apt-get install gparted") Linux partitioning tools do not do formatting which is left with the installer. The command to format in the terminal is available in /sbin with the symtax like mkfs.xxx where xxx is the filing type. You can see them by command

```
ls /sbin/mk*
```
A command like "mkfs.ntfs" is to format the partition in NTFS. The manual of each command is available if you type "man" before the command.

Lastly if you are not already aware each partition has a Type Number or Id as shown in fdisk output. Type 7 is for NTFS and all Linux partitioning tools create type 83 by default. Thus if you want to create a partition to hold a NTFS filing system you need to change the Type number with cfdisk from Type 83 to Type 7. If you present the partition, with the correct type 7 to a MS Windows installer it will recognize it, sink its teeth into it and will not let go. I always use Linux to partition for all operating systems.

Also you only need one swap regardless the number of Linux you have in the box.

If you run into problem just let us know.


----------



## TRS-80 vet (Jun 18, 2005)

Using an application to fix a problem is not usually the best way to work, in my opinion. If the problem gets fixed, great. But if the problem does NOT get fixed, chances are that you will not have 2 problems, but 1 much BIGGER problem. 

PCLinuxOS 2007 was the best OS I ever used. I tried PCLOS 2010 with Gnome desktop, and it was good until I did the first update, then X crashed beyond repair. Support is good in the PCLinuxOS forums, with the main developer 'Mike' frequenting the boards...


----------



## sonic47 (Mar 8, 2007)

Thanks for all the partition information it is a lot to read and digest and learn it will take some time, I was surprised by your comment about " pclinux 10 " as the media on line seem to rate it , I had just orderd a copy of each GNOME and KDE what do you suggest as i am not quite comfortable with ubuntu as all the programs have different names to what i am used to and i prefer the task bar to be at the bottom of the screen yours for now Andrew PS what is " PCLOS 2010 " TRS-80vet ??;


----------



## TerryNet (Mar 23, 2005)

In Ubuntu you can right click on the task bar - Properties - and put it on any edge (top, bottom, left, right).

What programs, and what names are you used to?


----------



## TRS-80 vet (Jun 18, 2005)

sonic47 said:


> Hello saikee i am in problem solved i coped and pasted the command into terminal and restarted and bingo i got the boot screen list with ubuntu and others and winxp i cannot thank you enough , I am going to give a few days to get more familiar with linux then try out PCLINUX distro , i would like to hear of any addvice you can give to formating partitions to linux prior to installing " pclinux ", yours thanks again Andrew.


PCLinux distro is PCLinuxOS 2010 - it's the current distribution of PCLinuxOS (Operating System). The last distribution was PCLinuxOS 2007.

I think the most user-friendly distribution is Ubuntu - for a beginner I'd suggest Ubuntu 8.04


----------



## sonic47 (Mar 8, 2007)

Sorry back again i have no sound online or from media players can you help Andrew.


----------



## TerryNet (Mar 23, 2005)

> I think the most user-friendly distribution is Ubuntu - for a beginner I'd suggest Ubuntu 8.04


I agree with the first part of that, but there are no doubt pros and cons with going with a 5-version-old distribution. One of the cons is that there are probably more people willing and able to answer questions about a more recent version. Apparently sonic47 is already using 10.04 or 10.10. (FWIW, Ubuntu 8.04 was my first Linux distro, but that was in spring, 2008.  )



> Sorry back again i have no sound online or from media players can you help Andrew.


With what operating system(s)?


----------



## TRS-80 vet (Jun 18, 2005)

I think he said he's added


> ubuntu 10.about


 but 10.04, or 10.10? Then he said he's ordered PCLINUX - probably PCLOS 2010.

I imagine LOTS of people have loaded 10.10, and are ready to help with the most common *reply* to problems posted on internet forum boards - "Me too!"

I think at any time, the best OS would be the oldest OS that's still supported - 8.04 in this case. Sure, with people always anxious to get 'new stuff', everybody is buzzing about it - noisily buzzing...

BUT, with a 'mature' OS, that has had problems addressed, and solved, for 3 1/2 years, there are likely NO UNsolved problems with it, and solutions are documented, with explicit instructions, from the developers (or advanced users, with forum boards' 'Stickies'). Wouldn't you agree???

But alas, the choice is sonic's to make...


----------



## sonic47 (Mar 8, 2007)

Hi Saikee i have made some progress at last as you can see. cfdisk (util-linux-ng 2.17.2)

Disk Drive: /dev/sda
Size: 200049647616 bytes, 200.0 GB
Heads: 255 Sectors per Track: 63 Cylinders: 24321

Name Flags Part Type FS Type [Label] Size (MB)
------------------------------------------------------------------------------
sda1 Boot Primary NTFS [ ] 84843.77
Pri/Log Free Space 0.04*
sda5 NC Logical NTFS 19899.28*
sda6 NC Logical Linux ext3 32863.43*
sda7 NC Logical Linux ext3 5999.14*
Pri/Log Free Space 56441.41*

[ Bootable ] [ Delete ] [ Help ] [ Maximize ] [ Print ]
[ Quit ] [ Type ] [ Units ] [ Write ]

Quit program without writing partition table
But now i would like to know how increase the size of sda1 by about 10GB and format the remander to sda6 83 and allso format 56441.41GB space to sda6 83, PS i think i am slowly getting the hang of the terminal commands Ha Ha yours Andrew


----------



## saikee (Jun 11, 2004)

If you think of a hard disk same as a note book, with the number of pages equal the number of cylinders of the hard disk , then you have the first part of it arranged as chapter 1 equivalent to the sda1 partition.

You currently have 3 other chapters sda5, sda6 and sd7 appended immediate to sda1 with little or no space in between. Thus physically the only way you can "resize" sda1 is to move sda5 to sda7 further down the line. This is easy said than done because being sda5 and above they are logical partition defined by a boundary. The definition of the boundary is called extended partition and in you case it would be sda2 even if you haven't shown us.

You can move an extended partition, which must be converted from one of the previous primary partition of sda1 to sda4, to anywhere in the hard disk as your hard disk has space below sda7. However this is not recommended, but (in you case it would be OK if you want to learn about it and will to do extra work) if you have operating systems inside. Many operating systems would have boot loaders at the front end. If you move one the hard disk address will be altered resulting the boot loader residing in the MBR unable to find it. Therefore you need to reconfigure the boot loader, which is Grub, in the MBR again.

In general if you have not got much in sda5, sda6 and sda7 it would be easier to copy the information temporarily into sda1 or a USB device, delete the sda5 to sda7, resize sda1 and then re-create sda5 to sda7 to sizes of your choices and even resinstall the Linux again.

To resize and move a partition the most powerful and flexible tool is gparted (Gnome partition Editor). It is in the Ubtnu Live CD but not in an installed version. You can run it from a Live CD which is recommended or install it inside a Ubuntu using just a terminal command

```
sudo apt-get install gparted
```
Once install it is available by clicking system/administraion/partition editor.

So let us know which route you wish to take

Route 1 : Move sda5/6/7 as an extended partition down the hard disk to make space for sda1 and then re-configure Grub

Route 2 : delete sda5/6/7, resize sda1 and then rebuild sda5 /6/7

Different instructions for different routes but always copy and paste the full output of "sudo fdisk -l" here like mine below

```
[email protected]:~$ sudo fdisk -l
[sudo] password for saikee: 

Disk /dev/sda: 300.0 GB, 300090728448 bytes
255 heads, 63 sectors/track, 36483 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb327b327

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       36483   293049666    5  Extended
/dev/sda5               1         122      979902   82  Linux swap / Solaris
/dev/sda6             123       24437   195310206   83  Linux
/dev/sda7           24438       36483    96759463+  83  Linux
[email protected]:~$
```
A full fdisk -l output tells us the cylinder positions of each partition. Mine has sda7 with the end cylinder equal to the maximum in the hard disk so I have no free space. Since my sda5 start cylinder equal to the beginning of the hard disk that means I have no primary partition in my hard disk. and this can b e confirmed by "sudo sfdisk -l"

```
[email protected]:~$ sudo sfdisk -l

Disk /dev/sda: 36483 cylinders, 255 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1   *      0+  36482   36483- 293049666    5  Extended
/dev/sda2          0       -       0          0    0  Empty
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty
/dev/sda5          0+    121     122-    979902   82  Linux swap / Solaris
/dev/sda6        122+  24436   24315- 195310206   83  Linux
/dev/sda7      24437+  36482   12046-  96759463+  83  Linux
[email protected]:~$
```
Lastly if you wish to format a Type 83 Linux partition you need to tell the kernel what filing system you want. For example it it is Ext4, standard in Ubuntu latest release the command is simply ( for sda6)

```
sudo mkfs.ext4 /dev/sda6
```
The choice of different filing systems are seen in /sbin directory

```
[email protected]:~$ ls /sbin/mk*
/sbin/mkdosfs   /sbin/mkfs.cramfs  /sbin/mkfs.ext4dev  /sbin/mkfs.reiserfs
/sbin/mke2fs    /sbin/mkfs.ext2    /sbin/mkfs.minix    /sbin/mkfs.vfat
/sbin/mkfs      /sbin/mkfs.ext3    /sbin/mkfs.msdos    /sbin/mkreiserfs
/sbin/mkfs.bfs  /sbin/mkfs.ext4    /sbin/mkfs.ntfs     /sbin/mkswap
[email protected]:~$
```
 In general you need to match the partition type with the filing type so "mkfs.ntfs" command should only be carried out on a Type 7 partition. You will find Linux is a very clear operating system and will check the actual filing system before mounting it so an error in the partition type is tolerated. However a MS Windows depends on the partition type and will not mount one unless it is amount those supported by M$. PC Users can change a NTFS partion type 7 to 17 to make it a hidden partition to a MS Windows. When the partition is needed they change the Type number back to 7 and the MS Windows would mount it immediately. There is a lot of fun with partitions.


----------



## sonic47 (Mar 8, 2007)

Thanks for your reply Saikee it was a lot to digest, Ithink i may reinstall linux and winxp and start a fresh as you suggested, would i have to reinstall linux ( not shore which distro yet) first then winxp i have read lots of sites with different ides, But at the moment i have a new laptop as a backup which has win7 on a 320GB HDD but i would allso like to have linux dual boot allso , I will have a recovery disk for win7 ( i will have to burn it ) and various linux distros , i have read that you have to have a full install disk for win7 is there any other way around this yours Andrew.


----------



## saikee (Jun 11, 2004)

Win7 has its own resizer inside "disk management" with which you can reduce an existing partition to a smaller size thereby releasing the hard disk space for other systems.

Thus you don't need Win7 installation disk but you can still get one if you search the Internet.

Win7 installation disks are available in the Internet so you can download the correct version for you PC. As long as you have the original product key the Win7 installer doesn't mind from which installation disk it is launched. Just make sure the version matches your product key.

Before the released Win7 free copies could be downloaded and many of them are still in circulation even though they cannot be activated. You can use them and switch to the your own product key when asked. Win7 allows a user to change the product key.


----------



## sonic47 (Mar 8, 2007)

Can you tell me the name of the site for the win7 download.


----------



## TerryNet (Mar 23, 2005)

Whoa! *saikee*, your advice about downloading a Windows 7 is out of line. Any such download would be a pirated copy, even if it had not been "enhanced" with malware. I think I know you well enough to believe that this comment will be enough to prevent you from posting this type of advice here again so I will not give you any infraction or official warning.

*sonic47*, in addition to making your set of Recovery disks also do Start - All Programs - Maintenance - Create a System Repair Disc. The latter will let you do various repairs such as to the master boot record if and when needed. If you ever do need a Windows 7 installation DVD you can borrow from a friend one of the correct type--OEM, same version, but do not download any pirated copy.

Since Windows refuses to recognize the existence of any other OS it is always preferable and much easier to install Windows before Linux. Almost always Linux (GRUB) will find the Windows and set up your dual boot pretty effortlessly.

While the Windows Disk Management will handle some partitioning tasks, such as resizing to free up room for another partition, 3rd party utilities often do more and better. I like EASEUS Partition Master for running within Windows and GParted for when I can't boot into Windows.


----------



## TRS-80 vet (Jun 18, 2005)

TerryNet said:


> Whoa! *saikee*, your advice about downloading a Windows 7 is out of line. Any such download would be a pirated copy, even if it had not been "enhanced" with malware. I think I know you well enough to believe that this comment will be enough to prevent you from posting this type of advice here again so I will not give you any infraction or official warning.


'Pirated', if downloaded from the web? I bought one of these from my local pc shop tech, and used my ORIGINAL COA, and WGA has no problem with it. Nor did WGA have a problem on a friend's machine, with her ORIGINAL COA.

If this is TSG interpretation of 'pirated', fine. If it's the MS interpretation, I'd like to see that...


----------



## TerryNet (Mar 23, 2005)

You can legitimately buy Windows 7 online and you will be given a download link to be used for your purchase. You can also get ahold of this temporary link by hook or by crook and illegally steal the downloadable copy. That is stealing. It is a pirated copy if you obtain it this way. If you run a dishonest shop you can even sell one of these pirated copies to a (possibly unsuspecting) customer.

There are some mods here, mostly more knowledgeable about these issues than I, who are uncomfortable with my advice to borrow a friend's legitimate copy. It's not clear that is a legitimate use of the license. But since there seems to be less likelihood for abuse I have not yet been gagged. Thank you for your concern, but please drop the subject, at least for this thread. Bring it up in the Site Comments section or with an Administrator if you want to pursue it further.


----------



## sonic47 (Mar 8, 2007)

I do not think you have read my threads carefully i do not want a pirated copy of win7 i just want a full version disk that i have payed for when i purchased my new laptop for which i have a full license for which took time to save money for, I do feel cheated by microsoft or Acer for not providing a disk with the laptop, Allso i had to obtain an language pack so i could change the french installed version to english which i do feel should have a choice of languages on the standard version installation , Every thing you want to do with microsoft involves more money all the time nothing is free that is why i am slowly moving over to linux i hope this makes things a bit clearer yours Andrew PS Thanks again Saikee for all your help.


----------



## TerryNet (Mar 23, 2005)

> I do feel cheated by microsoft or Acer for not providing a disk with the laptop ...


A lot of us have similar feelings. Microsoft requires that OEMs make it possible for the customer to "get Windows back to factory defaults." It is Acer and the other OEMs who decided to provide Recovery partitions and/or Recovery disks instead of an installation DVD. Another member suggested (in a previous thread) that when buying we should insist on getting the installation disk. Of course, if we didn't do that--I didn't--we are stuck with what we bought.



> I do not think you have read my threads carefully i do not want a pirated copy of win7 ...


Technically you did ask that in post # 28, but we know you did not intend to do that and nobody is accusing or suspecting you of any such thing. Frankly I think that all three of us who have responded to you in this thread have been reading carefully and trying to respond accurately. Some of us have, or at least had, an honest difference of opinion on exactly what's permissible and what's not, but that doesn't mean we are not reading posts carefully.


----------



## sonic47 (Mar 8, 2007)

Hello saikee in reply to your No 25 thread i think the easiest root for me is to delete sda 5 6 and 7 and increase size of sda 1 and reinstall ubuntu , I would be happy if you could explain to me the way to go about it step by step, i have tried to make room for sda 1 using sda 5 with out success as you can see under

Size: 200049647616 bytes, 200.0 GB
Heads: 255 Sectors per Track: 63 Cylinders: 24321

Name Flags Part Type FS Type [Label] Size (MB)
------------------------------------------------------------------------------
sda1 Boot Primary NTFS [ ] 84843.77
Pri/Log Free Space 0.04*
sda5 NC Logical Linux ext3 9391.05*
Logical Free Space 10505.88*
sda6 NC Logical Linux ext3 32865.79*
sda7 NC Logical Linux ext3 5999.14*
sda8 Logical Linux ext3 56441.41*

I do not mind losing contents of sda 6 but do not want to lose contents of sda 1 as it takes for ever to install winxp and all the updates and all other software , yours andrew


----------



## saikee (Jun 11, 2004)

You need a Ubuntu CD.

Run it as a Live CD.

Choose a terminal, issue this command

```
sudo cfdisk /dev/sda
```
Inside cfdisk delete sda5, sda6 & sda7. Click write and confirm with a "yes".

Check the partition table with 

```
sudo fdisk -l
```
Optional : You can reboot Xp and see if it is working normally as before. Reboot the PC after a major change to the partition table is a good move.

Run Ubuntu CD again. click System/Administration/Partition editor

You will see sda1 is a box. Just highlight sda1, right-click it, select move/resize and drag the right border to the new size you desire. Once satisfied with the new size then click apply.

Once done reboot to check Xp working happily before using cfdisk to re-create sda5, sd6 and sda7 and do whatever you want with them.

Please note that Ubuntu has Gparted (Partition Editor) inside the installation CD but it is not included in a standard installation. It can be added by Synaptic Package Manager though. Just one of few quirks in Ubuntu.


----------



## sonic47 (Mar 8, 2007)

Hi saikee i did as you said but still got into bother with booting into winxp the only way i can get to boot is with the live cd i have included what i have now cfdisk (util-linux-ng 2.17.2)

Disk Drive: /dev/sda
Size: 200049647616 bytes, 200.0 GB
Heads: 255 Sectors per Track: 63 Cylinders: 24321

Name Flags Part Type FS Type [Label] Size (MB)
------------------------------------------------------------------------------
sda1 Boot Primary NTFS [ ] 84843.77
sda5 NC Logical Linux 115203.28

look forward to your reply andrew

[ Bootable ] [ Delete ] [ Help ] [ Maximize ] [ Print ]
[ Quit ] [ Type ] [ Units ] [ Write ]

Quit program without writing partition table


----------



## saikee (Jun 11, 2004)

You need to delete sda5 as well so that the right hand side of the boundary of sda1 is free to expand.

By having sda5 sda1 cannot grow in size.

Use Gparted from a Live CD as instructed in Post #35


----------



## sonic47 (Mar 8, 2007)

I did as you advivsed in gparted but it would not boot into windows xp i get grub rescue i looked in the terminal and it says as under

FATAL ERROR: Bad primary partition 0: Partition ends in the final partial cylind
Press any key to exit cfdisk
looking in gparted it says that dev sda 1 is not mounted look forward to your reply PS fogive the english i a; typing on a french key board so;e of the keys are in diffarant places


----------



## psyenz (Jan 1, 2011)

saikee said:


> Sorry I have been away.
> 
> Let's get this sorted.
> 
> ...


sorry, bit off topic here but just wanted to say thanks to saikee - i'd done something similar to what sonic47 had, and after reading the instructions in this post i was able to get it fixed.


----------



## sonic47 (Mar 8, 2007)

Hi saikee please disregard thread 38 as i have regained winxp and reinstalled ubuntu 10.10 but checking the partitions with partition magic in winxp the program updated and took over the whole sda1 200 gig partition, i can allso boot into ubuntu but gparted cannot see the drives contents, i tried windows system restore but didnot work do you think if i uninstall partition magic it will let go of the drive? i know you said not to usr P magic but i was justing looking at the partitions after the reinstall of win and ubuntu . Andrew.


----------



## saikee (Jun 11, 2004)

*sonic47,*

Been away to NYC and Vermont for 2 weeks and just back home.

Can you post the latest fdisk -l output here?

If you have given Winxp the entire disk and then installed Ubuntu then you might have installed Ubuntu "inside" Winxp. Ubuntu has many versions. A stand alone Linux always has its own partition Type 83.

*psyenz, *

Nice to hear you get your system up with the same instructions.


----------



## sonic47 (Mar 8, 2007)

Hi saikee hope you had a nice couple of wks, What i had before i opened p magic was winxp on the first partitiion of about 110 GB next in ext4 partition 2 partitions around 40GB each with ubuntu installed i one of the 40GB partitions, i know this from cfdisk after i installed ubuntu, Then after i booted into winxp did a little browsing with firefox then opened P Magic to see the partition layout that is when it updated the whole drive to windows but it does show as being a bad partition i have tried to uninstall P Magic but cannot find the uninstall file even winxp uninstaller does not show it i am tempted to just delete it from program files and from REGEDIT but i fear it would make things worse , perhaps it would be easier to just reinstall ubuntu again anyway i have included what i found in FDISK

[email protected]:~$ sudo fdisk
[sudo] password for andrew:

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 switch off DOS-compatible mode
-h print help
-u <size> give sizes in sectors instead of cylinders
-v print version
-C <number> specify the number of cylinders
-H <number> specify the number of heads
-S <number> specify the number of sectors per track

[email protected]:~$ -l <disk>
bash: syntax error near unexpected token `newline'
[email protected]:~$ fdisk -l 
[email protected]:~$ cfdisk

[email protected]:~$  fdisk [options] -l <disk> 
bash: syntax error near unexpected token `newline'
[email protected]:~$ fdisk -s <partition> 
bash: syntax error near unexpected token `newline'
[email protected]:~$

as you can see i have tried some commands with fdisk and cfdisk

FATAL ERROR: Cannot open disk drive
Press any key to exit cfdisk
yours Andrew.


----------



## saikee (Jun 11, 2004)

Copy and paste the commands here, one line at a time and post the output.

```
sudo su
fdisk -l
cfdisk /dev/sda
```
The "sudo su" enables you to become the root user temporarily and so no need to attach the "sudo" in front of every system-related command where the root privilege is demanded. Once accepted the prompt will change from an ordinary user to a root user.

If you do not have root privilege but use a system-related command you will see no response from Ubuntu.

"fdisk -l" list all the partitions of every hard disk in the system.

"cfdisk /dev/sda" is to partition device sda. If there is a fault cfdisk will fail first but there is an off chance fdisk still works, hence the two commands suggested.


----------



## sonic47 (Mar 8, 2007)

that was a quick reply hear goes



Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x039e3bb4

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13912 111748108+ 7 HPFS/NTFS
/dev/sda2 13912 24321 83612354 5 Extended
/dev/sda5 13912 19043 41214021+ 83 Linux
/dev/sda6 19043 24100 40614912 83 Linux
/dev/sda7 24100 24322 1783808 82 Linux swap / Solaris

Disk /dev/sdb: 60.0 GB, 60022480896 bytes
255 heads, 63 sectors/track, 7297 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x62576257

Device Boot Start End Blocks Id System
/dev/sdb2 * 2 7297 58605120 f W95 Ext'd (LBA)
/dev/sdb5 2 2524 20265966 7 HPFS/NTFS
/dev/sdb6 2525 7297 38339091 7 HPFS/NTFS


The third line did not get much as under

FATAL ERROR: Bad primary partition 1: logical partitions overlap
Press any key to exit cfdisk
i will remember those commands for the future yours Andrew


----------



## saikee (Jun 11, 2004)

sonic47,

You must have given the green light to Partition Magic to amend your partition table and got the mess today.

If a partition starts and ends exactly at each cylinder it will be healthy and accepted by all operating systems. For some reason MS systems do not always finish at exactly the cylinder and leave some dead space behind. That is no problem to Linux as it always starts at a next new boundary from the new cylinder. P Magic, at least some older versions of it, does not understand Linux filing systems but claims to be able to do partitions for it. When it finds the dead space it tries to eliminate it and the result is a messed up partition table only operable in MS systems.

This apparently has happen to your sda hard disk with the end sda1 sharing the same cylinder as sda5.

```
/dev/sda1 * 1 [COLOR="Red"]13912[/COLOR] 111748108+ 7 HPFS/NTFS
/dev/sda2 [COLOR="Red"]13912[/COLOR] 24321 83612354 5 Extended
/dev/sda5 [COLOR="Red"]13912[/COLOR] 19043 41214021+ 83 Linux
```
Your sda2 is a border for the logical partition starting at 13912th and ending at 24321th cylinder.

For your situation I would delete sda2 as follow:

click "Start", then right click "My computer", then click "mange", "storage" and "Disk Management".

In disk management delete all partitions except the "c" drive which is the sda1 holding your Xp.

Reboot Xp and check everything working normally.

Run Ubuntu installation CD, run it as a Live CD first and use


```
sudo su
fdisk /dev/sda
```
to partition the sda again. fdisk uses cylinder as unit by default so use all the space after sda1 for an extended partition which should sda2. I always use sda5 for the swap so that I can freely select sda6 onward any size to suit my purpose. The swap is fixed size and should be no more than 200 cylinders and has Type 82. Any partition created by Linux partitioning tool will be Type 83 by default. If you do not know how to use fdisk type m to see the help page and check each stage by typing p. Also you can set up another terminal and display the manual page of fdisk by command "man fdisk"

The new partition table will only be created if you select "w" before quitting fdisk.

You can then instruct Ubuntu to run the installer and tell its installer to install Ubuntu in sda6.

Partition Magic is known as Partition Tragic. It is a Windows software that does not understand Linux. Don't use it to destroy your Linux partitions. If there is any comfort to you many PC users have bought it too including myself! It is one of the most dangerous software I have come across.


----------



## sonic47 (Mar 8, 2007)

Hi saikee i started to do as you advised but got called away to take a long phone call when i returned and found that my son had switched my pc off thinking he was being helpfull after i had only deleted one partition which changed to free space i was unable to boot into windows after please find fdisk display

Unable to open /dev/sda
[email protected]:~$ sudo su
[email protected]:/home/ubuntu# fdisk -l
omitting empty partition (5)

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x039e3bb4

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13912 111748108+ 7 HPFS/NTFS
/dev/sda2 13912 24321 83612354 5 Extended
/dev/sda5 * 221681 294638 586024777 86 NTFS volume set
/dev/sda6 ? 72280 212796 1128694508+ 4f QNX4.x 3rd part

i was unable to open cfdisk if you can tell me how to delete partitions 2 5 6 which i have tried to do in the terminal yours Andrew


----------



## saikee (Jun 11, 2004)

Since you can run fdisk then you should be able to use fdisk to do deletions.

It is very simple.


```
sudo su
fdisk /dev/sda
```
Inside fdisk you type 

```
d
```
 for delete. Fdisk then gives you the choice of 1,2,5 & 6. You then type

```
2
```
 and the extended partition sda2 will disappear together with all the logical partitions sda5 and sda6 inside. You then type

```
p
```
to see the latest partition. If no error reported you commit by typing

```
w
```
to write the new partition and then

```
q
```
to quit.

If fdisk reports any error do not type "w". Just quit by "q" and the current partition table will not be changed.

You can have 50 logical partitions inside an extended partition. The removal of the extended partition will nuke the 50 logical partitions automatically.

When you delete a partition ( or several partitions) you do not touch the partition interior. You just destroy the contents page page to find it. The partition table is the contents page. In your case the contents page of sda2 is from 13912th cylinder to 24321th cylinder.

Previously I suggested the Windows way because your sda1 overlaps with sda2 and using Windows, which is inside sda1, is a bit safer because it is the WinXp you want to preserve. Winxp will prevent you from damaging its own partition.


----------



## sonic47 (Mar 8, 2007)

:Hi saikee all problems solved thanks to you and i just want to say you have been very patient with some of my self inflicted problems , i have at last received a copy of ( practical guide to linux by M G Sobell ) which i will study carefully but can you tell me where i can find more explanations of the terminal commands which idiots can understand anyway thanks again till next time Ha Ha Andrew.


----------



## saikee (Jun 11, 2004)

sonic47,

I enjoy Linux and find its terminal command set a gold mine.

It will work for you. It becomes easier if you think about it and appreciate the arrangements. The whole thing is very logical.


----------

