LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 12-12-2009, 02:37 AM   #1
hefi
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Rep: Reputation: 0
fdisk ruined my partition table


Hi all,

I used to have a partition table like this (according to fdisk)

/dev/sda1 * 1 7649 61440561 7 HPFS/NTFS
/dev/sda2 7650 38913 251128080 f W95 Ext'd (LBA)
/dev/sda5 7650 11473 30716248+ b W95 FAT32
/dev/sda6 11474 11535 497983+ 82 Linux swap / Solaris
/dev/sda7 11536 14598 24603516 83 Linux
/dev/sda8 14599 38913 195310206 b W95 FAT32

I would have liked to format the first FAT32 partition (/dev/sda5 in the table above) to ext3.

So I started
# fdisk /dev/sda
deleted the 5th FAT32 partition (/dev/sda5), added a new ext3 partition.

After this action I got this table:
/dev/sda1 * 1 7649 61440561 7 HPFS/NTFS
/dev/sda2 7650 38913 251128080 f W95 Ext'd (LBA)
/dev/sda5 11474 11535 497983+ 82 Linux swap / Solaris
/dev/sda6 11536 14598 24603516 83 Linux
/dev/sda7 14599 38913 195310206 b W95 FAT32
/dev/sda8 7650 11473 30716248+ 83 Linux

OK, I thought my new linux partition is /dev/sda8, so I formatted it:

# mkfs.ext3 /dev/sda8

After the reboot, my linux system was unable to boot due to the number of linux partition had changed. Grub exited with Error 17.

So I took my Ubuntu disk, started live ubuntu, and changed fstab, grub's menu.lst and chaged it to the new partition devices.

After reboot, I realised that my second FAT32 partition had disappeared. I'd have liked to mount the new partiton as ext3 but it did't work.

I found out that I'm able to mount with only different type:

# mount | grep sda
/dev/sda8 on /mnt/media type vfat
/dev/sda7 on /mnt/linmedia type ext3

fdisk says:
/dev/sda7 14599 38913 195310206 b W95 FAT32
/dev/sda8 7650 11473 30716248+ 83 Linux

Now I've got ext3 on wrong partition. Maybe I formatted my second FAT32 to ext3?

How could I restore my second FAT32 partition?

I use Ubuntu 8.04
 
Old 12-12-2009, 03:39 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,684
Blog Entries: 54

Rep: Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955Reputation: 2955
Welcome to LQ, hope you like it here.


Quote:
Originally Posted by hefi View Post
Now I've got ext3 on wrong partition. Maybe I formatted my second FAT32 to ext3? (..)How could I restore my second FAT32 partition?
As you've experienced you are able to (re)format a partition contents to another filesystem type, but it's not until you change the type in the partition table that you're done. In your case you can do that easily with fdisk. ( BTW there was no need for deleting /dev/sda5 and creating a new partition. You could have edited the partition table in fdisk and change type (t) of /dev/sda5 to (0x)83, written out (w) the new partition table, verified it by printing it (p), close fdisk, then mkfs'ed it. ) In more disastrous cases you'd want a second opinion of Testdisk. If changing the type (back) doesn't let you mount it automagically then you may have (re)formatted the partition.
As the filesystem structure was overwritten it'll not be as much a case of fixing and restoring things as it is of recovering what remains before starting over again.
If you didn't make backups then recovering contents of a filesystem after such an operation usually comes down to running Photorec on the partition to recover contents and save them to a physically different disk or partition before running the whole change type (t), write out (w), verify (p), mkfs routine again.

Practicing (like practicing making backups ;-p) and reading up on using tools the right way will help you get the most out of GNU/Linux. Next time you might also want to read up on and check out disktype, gpart and parted.
 
Old 12-17-2009, 07:26 AM   #3
hefi
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Yes, I successfully killed that partition

Thanks for suggesting restore tools! I tried Testdisk, but unfortunately it restored only chunks, without filename.

Basically I've got backup of the whole lost partition, but it gonna take loads of time to restore.
 
  


Reply


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
fdisk partition table representation vofka Linux - General 3 06-27-2009 04:20 PM
fdisk - invalid DOS partition table... hjogoo Linux - Hardware 12 01-22-2009 12:08 AM
Hosed partition table with fdisk. Any way to restore from memory? Vanyel Linux - Server 7 10-08-2008 04:06 PM
fdisk will not write partition table winter_wizzerd Slackware 5 01-06-2007 12:08 PM
fdisk said my HD didn't have valid partition table??? bombman Linux - Newbie 6 08-28-2006 12:53 PM


All times are GMT -5. The time now is 05:51 AM.

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