You are not logged in.

#1 2004-07-30 11:30:26

dad4a
Member
Registered: 2004-06-13
Posts: 14

Recreate Partition Table

I have the following partition table issue:

"fdisk -l" outputs that "Partition table entries are not in disk order"

I want to recreate the partition table.

Questions:
1. should I done this from within the OS on hard disk or should I boot with a, e.g., floppy disk?
2. which program should I use (parted or fdisk or any other)?
3. Is the procedure as simple as a) note the reported values of "fdisk -l" (or parted) b) delete all partition entries c) use the recover option of parted (or manually do the same thing).

Cheers!

Offline

#2 2004-07-30 22:59:25

cs25x
Member
Registered: 2004-05-04
Posts: 150

Re: Recreate Partition Table

First of all, it aint real broke, do you want to fix it?
Next, if you are using lilo, you can save your partition table, before you do anything else. This is  for moments like these.

 man lilo

search  via /artition,  the -s flag is something you will have to  know about.

fixing it: with fdisk

fdisk /dev/WhateverDiskItIs
p
{ note the partition start  & end values }
d the out of order partitions
m them again, using the same values, BUT
do it in order. i.e. start - end2 follows start-end1
w
Next problem is that your partitions will have moved to their new numbers when (if) you reboot.
So, you will have to look at their  /etc/fstab entries and change them too.

Good Luck.

smile


--(*(cs25x--));

Offline

#3 2004-07-30 23:28:07

dad4a
Member
Registered: 2004-06-13
Posts: 14

Re: Recreate Partition Table

thanks for the suggestions. I am not very confident about this but I suspect that some problems I encounter in a Windows system I run are related to the partition table so I will give it a try.

Offline

#4 2004-07-31 10:17:20

Leigh
Member
From: USA
Registered: 2004-06-25
Posts: 533

Re: Recreate Partition Table

I don't know if this will help, but usually when you create, modify or
delete particians and save the scheme, a new table will automatically
be written to disk. Trying to change the table without modifying the
exisiting scheme could be tricky and probably make your os unbootable
without modifying fstab and probably other system files.


-- archlinux 是一个极好的 linux

Offline

#5 2004-08-02 22:25:54

dad4a
Member
Registered: 2004-06-13
Posts: 14

Re: Recreate Partition Table

I would like to report my experience with recreating the partition table.

I used parted and the procedure is really simple and safe. I used the rm and rescue command of parted which adds a level of security of wrongly typed the start and end of partitions.

All linux native partitions and fat partitions were correctly identified except ntfs for which I had to use the mkpart command. Strangely enough even though the partition's filesystem was reported correctly as ntfs its id number was linux native: so I used fdsik to correct this.

The only limitation of parted is that it commits the actions immediately, so in case of emergency you may end up with some problems. Anyway the procedure is easily corrected as long as you don't create wrong start/end points and/or format the partition.

The above procedure was done knowing the partition table. I don't know how parted would behave if you had  a corrupted partition table and no idea of its initial partition sizes.

Offline

#6 2004-08-02 22:44:05

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Recreate Partition Table

if everything works, but you simply wonder because of an error of this command, my advice would be: let it be! and make a backup of your hdd, so if it happens that you no longer can access the data, you are prepared

if you have non-accessible partitions/parts of hdd, then first read this
http://staff.washington.edu/trav/linux/ … ition.html

then here my advice:
gpart is a very nice tool that tend to detect partitions, but it is not perfect at all!!! (i played about a year ago with it on a 10GB hdd and saved some data for a friend, but it took hours gpart to read the disk and it detected one partition wrong, so we lost one partition (it assumed there are 3 #83 partitions, but it was a compaq support (FAT12) and a #83 containing /boot, but that was not so horrible))

good luck and patience


The impossible missions are the only ones which succeed.

Offline

#7 2004-08-02 22:48:01

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Recreate Partition Table

ohh ... forgot ... if you have another hdd with enough space to contain the image of the whole broken one, i would suggest you to make a backup (e.g. with dd) of your broken hdd before you start experimenting --- today, hdd-space is not that expensive, and it would be much easier (compared to my try a year ago) as bckp is easy made and gives you at least a good feeling that you can 'undo' what you do with gpart/parted


The impossible missions are the only ones which succeed.

Offline

#8 2005-12-27 14:15:52

jakob
Member
From: Berlin
Registered: 2005-10-27
Posts: 419

Re: Recreate Partition Table

Hah, this is my thread... here we go:

yesterday i moved my home to an external hdd: /dev/hdb1
Since hdb2 were 300MB swap and hdb only had 2Gb i wanted to put the swap onto another disc and resize hdb1 to fulfill the space on hdb...

But anywhere (i don't know why or when) i seemed to have deleted the partition table...

Since then i of course wasn't able to mount it (bad superblock, no fs etc...) and had several  gpart checks running on it without success (gpart only finds the swap-partition)

i also made a copy of hdb1 with ddrescue an tried to create a partition table with ext2, formerly it was ext3 but that should not be a problem, right?) there withs parted, but then it isn't possible to mount it with loop, neither (bad superblock)

when i print now the partition table of the backup file, i see, that the partition starts at 16 kb. The original partition startad at 1kb so no wonder that it's not set up correctly..i think this is due parted...

So if i would create a new partition with the data of the old one on hdb with cfdisk (where i think i could define the starting block more exactly) may i have luck and be able to find some of my (of course not backupped) files again or is everything broken?

greetings,

hellwoofa

Offline

#9 2005-12-27 21:07:49

jakob
Member
From: Berlin
Registered: 2005-10-27
Posts: 419

Re: Recreate Partition Table

ok... i could not wait for it anymore so i simply did make a new partition to the old boundaries, tried to mount and it worked with afai could see all data still lying on the disc... then i instantly cp'd everything to another disc, and recreated the partition table to the whole disc, mounted again and still everything is fine... i'm so glad... didn't you hear the rock falling from my heart? smile

with greetings,

hellwoofa

Offline

#10 2005-12-28 20:35:49

Komodo
Member
From: Oxford, UK
Registered: 2005-11-03
Posts: 674

Re: Recreate Partition Table

hellwoofa wrote:

didn't you hear the rock falling from my heart? smile

lol


.oO Komodo Dave Oo.

Offline

Board footer

Powered by FluxBB