LinuxQuestions.org
Visit Jeremy's Blog.
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 11-25-2014, 11:57 AM   #1
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,176

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Lost partition problem


This is a difficult problem to summarise, but here goes.

1. I have 4 partitions: 3 for CentOS and sda3 for installing distros I want to test. Today, running the new Puppy, I tried to reformat sda3 but Gparted crashed. I was then unable to restart CentOS, because the boot routine hung when the MBR said there were 4 partitions and Linux couldn't access sda3.

2. I booted a live disk — Antix — to try to repair things. Gparted wouldn't work. I tried fsck, which said the partition was zero-length, and mkfs, which failed. Then I tried what was probably a bad move, and deleted the partition with fdisk. Unfortunately that failed to alter the MBR, so I still couldn't start CentOS.

3. Then I tried to run the CentOS installer, intending to use that to repair the partition, but it failed to load. So I switched to the Salix installer. That did enable me to delete the partition and put a new one in the free space, but when I tried to format it, that failed and CentOS still wouldn't start.

4. I ran the Salix installer again and just used it to delete the partition. I can now boot into CentOS again! But I have a gap where sda3 used to be and attempting to use Gparted in CentOS only created a bad partition which had to be removed again with Salix.

Is there anything I can do to get sda3 back? I had thought of using Gparted to expand swap over the empty space, rebooting, and then using it again to shrink swap and recreate sda3, but at the moment I've quit while I still have a working system!

Last edited by DavidMcCann; 11-25-2014 at 01:30 PM. Reason: correction
 
Old 11-25-2014, 02:43 PM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 3,001

Rep: Reputation: 393Reputation: 393Reputation: 393Reputation: 393
The partition table is probably corrupted. You can try using TestDisk to repair the partition table as described in this article:

http://www.linux.com/learn/tutorials...table-on-linux

However, I wouldn't even attempt this without having complete backups of your three good partitions(apparently sda1,sda2, and sda4). If you can't fix the partition table with TestDisk, you can try deleting sda3 and sda4 from your livecd. Then try recreating sda3 and sda4 with gparted and restore sda4 from a backup. Of course, if sda4 is your swap partition, then you won't have to worry about backing up or restoring it.
If that doesn't work, you will probably have to do what I refer to as a "nuke and pave". Basically, back up your data partitions. Get the hard drive manufacturer's hard drive diagnostic utility from their website. The major manufactures, Western Digital and Seagate have them in bootable iso form. You download the iso, burn it as an image to a cd and boot up with this cd. You can run some diagnostics on the hard drive if you want, but I would just do a "zero fill". That will write zeros to every sector of the hard drive which leaves the hard drive in the same condition it was when it left the factory. After that, partition the hard drive and restore your data partitions from a livecd. Finally, you will also have to restore your Centos bootloader from the livecd or other rescue media.
 
Old 11-26-2014, 03:39 AM   #3
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,650

Rep: Reputation: Disabled
Try using fdisk (in a terminal, as root) to see what Centos thinks sda3 is.
It should at least tell you where it starts & finishes.
Try deleting & re creating it with fdisk, write it to disk.
Now try to format it under Centos.
(You may need to reboot to use the new partition table.)

Last edited by fatmac; 11-26-2014 at 03:40 AM.
 
Old 11-26-2014, 04:13 AM   #4
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Have you run smartctl on the drive?
 
Old 11-26-2014, 11:50 AM   #5
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,176

Original Poster
Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Thanks for all the suggestions. Now I've got CentOS running again, admittedly without my guest partition, I shall leave it until I feel lucky and have lots of free time, before trying any drastic solutions!

I have compared the output of "cat /proc/partitions" and "fdisk -ul" and they agree, which is good news — unless they use the same source.
 
  


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
Not formatting a partition while installing Ubuntu but still data getting lost from that partition! ravisingh1 Linux - Laptop and Netbook 5 07-29-2014 01:44 AM
MDADM problem: partition lost because of mkfs.ext3 trivet.es Linux - Hardware 2 11-05-2008 07:51 AM
HDD partition lost. xandros DVD + me = lost data lein Linux - General 18 05-22-2007 05:47 AM
Dual Boot Problem - WinXP partition lost space? brianr747 SUSE / openSUSE 1 09-26-2006 05:06 AM
Dumb Newbie - lost linux partition + BIOS problem? BlendedRacer Linux - Newbie 2 06-28-2004 09:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:08 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
Open Source Consulting | Domain Registration