salvage bad partitiong

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post please read this

salvage bad partitiong

Postby Theleo on Tue Nov 25, 2008 10:12 am

This is my fdisk -l
Code: Select all
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x64656469

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3298    26491153+   7  HPFS/NTFS
/dev/sda2            3299        5921    21069247+  83  Linux
/dev/sda3            5922        6051     1044225   82  Linux swap / Solaris
/dev/sda4            6052        6075      192780   83  Linux


The first is a windows partition
The second is /
The third is swap
The last is /boot

I have made only primary partitions so I cannot use the unpartitioned space.
How can I create an extended partition without reinstalling everything?

Here is what i have so far.

-My first ideas was to swapoff then delete /dev/sda3(my swapping space)
and create an extended partition there. The problem is that when I try to make an extended partition there it do does not let me to use up all the space that is free probably because extended partitions need to be continuous I think.

-My second idea is to dd /dev/sda4 (this my boot) to an external drive,then delete the partition.
On the new space create an extended partition that will use up all the space up to the end of the disk.
Then create a partition on the extended and dd back from the external drive to the new logical partion.
Which files do I need to fix so to make this work(for example reinstall grub? /etc/fstab ?)?

-My third ideas was to use a /dev/loop remember reading about it in a magazine when someone wanted to reclaim space from bad partitiong just don't remember how the procedure was and if this will cover my case.

Any ideas?
Theleo
Level 1
Level 1
 
Posts: 9
Joined: Thu Nov 13, 2008 6:53 am

Linux Mint is funded by ads and donations.
 

Re: salvage bad partitiong

Postby Husse on Wed Nov 26, 2008 7:37 am

If you have a decent amount of memory you can do like this
Open gparted (or it's equivalent)
Delete the swap
Move sda4 so it borders sda2
When you do that gparted copies the partition to the new location and it takes rather long time but can be done (I've done it and got bored in the process) Of course in this case sda4 can not be the system partition and you better not do this in a storm :)
Then you create the extended ...
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19710
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: salvage bad partitiong

Postby Theleo on Wed Nov 26, 2008 12:58 pm

Thanks Husse.It worked

swapoff,deleting swap and using gparted to move the partition did the trick.In the details while gparted was making the move operation
it seems that it performed a bunch of actions don't know what exactly but it would be interesting to find out and see how i could have done it
with fidsk.

The next problem was that i ended up with /dev/sda1 /dev/sda2 and /dev/sda4(with sfdik -l i could see there was /dev/sda3 but with all 0s)
though this isn't a real problem just aesthetics i tried to solve but it wasn't easy. Delete /dev/sda4 with fdisk and created a new partition with the exact cylinder size partition now visible as /dev/sda3 from fdisk.The following thread helped alot on this.

http://bbs.archlinux.org/viewtopic.php?id=57776

next i edited /boot/grub/menu.lst and corrected: root (hd0,2)
since /boot is now on /dev/sda3

So far so good.But trying to boot again gave me an error 23.
I had to do some reading on how MBR works the following site helped.

http://www.geocities.com/thestarman3/asm/mbr/STDMBR.htm

And then the solution just hit me,boot from live cd and reinstalled grub.
Theleo
Level 1
Level 1
 
Posts: 9
Joined: Thu Nov 13, 2008 6:53 am

Re: salvage bad partitiong

Postby Husse on Wed Nov 26, 2008 7:13 pm

Two questions and I really read this with interest
Delete /dev/sda4 with fdisk and created a new partition with the exact cylinder size partition now visible as /dev/sda3 from fdisk

Why move the content of sda4 if you still deleted it - or did you somehow manage to keep the content? :shock:
boot from live cd and reinstalled grub.

Really - I can't repair grub from the Elyssa or Felicia live CDs or the installed versions and I need to do that once in a while....
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19710
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: salvage bad partitiong

Postby Theleo on Thu Nov 27, 2008 12:53 pm

Why move the content of sda4 if you still deleted it - or did you somehow manage to keep the content?

In short i managed to save the content.Let me elaborate.

After i turn off swap and deleted /dev/sda3(swap) and the moved /dev/sda4(/boot) my sfdisk -l was like :

Code: Select all
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x64656469

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3298    26491153+   7  HPFS/NTFS
/dev/sda2            3299        5921    21069247+  83  Linux
/dev/sda3                0            0            0         
/dev/sda4            5922        5955      192780     83  Linux


so i umounted /dev/sda4(boot)

then going in fdisk.use d (delete) /dev/sda4
create new partition .use n (new) here i my starting cylinder was 5922 and my end was 5955 exactly
as my previous partition.w (write) the partition table.

The filesystem does not get erased it is still there all u have to do is make a partition where the filesystem actually resides
of the same or larger size.I wonder if i had made it smaller what would have happened?

and so i ended up with something like the following

Code: Select all
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x64656469

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        3298    26491153+   7  HPFS/NTFS
/dev/sda2            3299        5921    21069247+  83  Linux
/dev/sda3            5922        5955      192780     83  Linux


The rest are easy well partioning wise.To keep the sanity of the system also had to fix /boot/menu.lst and reinstall grub.

Really - I can't repair grub from the Elyssa or Felicia live CDs or the installed versions and I need to do that once in a while....


Didn't have any problem with that,boot from live cd -->terminal-->grub(as root)
and then from the grub
root (hd0,2) ## since boot is on /dev/sda3
setup (hd0)
Theleo
Level 1
Level 1
 
Posts: 9
Joined: Thu Nov 13, 2008 6:53 am

Re: salvage bad partitiong

Postby Husse on Thu Nov 27, 2008 4:25 pm

Very interesting and a bit daring but it is a special case
About grub - something makes the grub not find stage 1 and/or install it in (at least) three of my computers
The remaining laptop is 3/4 dead :)
Image
Don't fix it if it ain't broken, don't break it if you can't fix it
Husse
Level 21
Level 21
 
Posts: 19710
Joined: Sun Feb 11, 2007 7:22 am
Location: Near Borås Sweden

Re: salvage bad partitiong

Postby Theleo on Thu Nov 27, 2008 8:06 pm

About grub - something makes the grub not find stage 1 and/or install it in (at least) three of my computers


Well if u want to get to the root of the problem the following page explains how grubs loads it self.
Also u can see with a simple dd what is writen to ur MBR and if it is screwed.

http://mirror.href.com/thestarman/asm/mbr/GRUB.htm

Basically MBR points to the first stage of grub.So maybe try to reinstall grub and check to see that it does point at /boot?
Well maybe it is a bit overwhelming information but it worths it.Just wen't through it fast i hope to
find time to read it carefully at some point.
Theleo
Level 1
Level 1
 
Posts: 9
Joined: Thu Nov 13, 2008 6:53 am

Linux Mint is funded by ads and donations.
 

Return to Installation & Boot

Who is online

Users browsing this forum: gold_finger and 18 guests