LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 08-24-2009, 10:36 AM   #1
charrah
LQ Newbie
 
Registered: Jun 2009
Posts: 5

Rep: Reputation: 0
Need to manually edit partition table


Ok well yesterday I installed the Windows 7 RC alongside my existing Ubuntu Jaunty installation and for some reason it removed the entry for the main ext4 partition from the table. I used testdisk and it found the ext4 partition, but it improperly discovered the NTFS partitions at the beginning of the hard drive and while my Ubuntu installation is safe and working now, the 2 NTFS partitions Windows had created have merged into one unmountable partition. I want to edit the partition table to properly show the NTFS partitions, but of course keep my Linux partitions. Thankfully I have a copy of the fdisk -l output before I ran testdisk, so I don't think there should be any guesswork.

Before testdisk:
Code:
Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe686f016

   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              13        6444    51657728    7  HPFS/NTFS
/dev/sda3            6445        9726    26362665    5  Extended
/dev/sda5            9229        9726     4000185   82  Linux swap / Solaris
After testdisk:
Code:
Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xe686f016

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        6444    51761398+   7  HPFS/NTFS
/dev/sda2            6445        9227    22354416    f  W95 Ext'd (LBA)
/dev/sda3            9229        9726     4000185   82  Linux swap / Solaris
/dev/sda5            6445        9227    22354384+  83  Linux
So my new partition table needs to have those two distinct NTFS partitions listed as in the first table, but keep my ext4 partition there. (the more I look at the second fdisk output, the more I worry testdisk left something to be desired actually; some of those start/end numbers don't seem quite right)
 
Old 08-25-2009, 12:13 PM   #2
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 669

Rep: Reputation: 134Reputation: 134
So, what's your question ?
 
Old 08-25-2009, 04:23 PM   #3
charrah
LQ Newbie
 
Registered: Jun 2009
Posts: 5

Original Poster
Rep: Reputation: 0
My question was how I would edit the partition table by hand to get the kind of setup I described; however since I had already broken so many things in Linux and didn't care for Windows 7 particularly I cut my losses, backed up, and reinstalled.
 
Old 08-26-2009, 12:09 AM   #4
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 669

Rep: Reputation: 134Reputation: 134
Quote:
Originally Posted by charrah View Post
My question was how I would edit the partition table by hand to get the kind of setup I described; however since I had already broken so many things in Linux and didn't care for Windows 7 particularly I cut my losses, backed up, and reinstalled.
For the next time your partition table will messed up

Using fdisk is quite simple:
Run it, and then you provided with menu.
You should delete all existing partitions, and then create new ones
(using start and end cylinder information you have) and set appropriative
type and boot flag.

Nothing you do in fdisk written back to disk unless you give 'w' command,
so there is always way back.

Another possibility before doing something dangerous ( == installing Windows) backup your partition table (or whole MBR) with dd command.
Then you'll be able tp restore it using same dd
 
  


Reply

Tags
partition, recovery


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
manually write partition table for deleted partition tihcra Linux - Software 1 07-30-2009 01:26 PM
Manually create partition table? FogSwimmer Linux - Software 7 12-29-2005 07:28 PM
Slack 10: S-ATA = "No partition table or unknown signature on partition table"? dissolved soul Slackware - Installation 11 08-05-2004 03:12 PM
How do I manually edit the K-Menu? Quattro Linux - Software 3 03-30-2004 02:46 AM
Uh-Oh... Manually Edit a Partition Table? davidbalt Linux - Software 11 03-02-2004 02:16 AM


All times are GMT -5. The time now is 03:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration