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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
11-25-2014, 11:57 AM
|
#1
|
LQ Veteran
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,176
|
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
|
|
|
11-25-2014, 02:43 PM
|
#2
|
Senior Member
Registered: Oct 2003
Posts: 3,001
|
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.
|
|
|
11-26-2014, 03:39 AM
|
#3
|
LQ Guru
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: One main distro, & some smaller ones casually.
Posts: 5,650
Rep:
|
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.
|
|
|
11-26-2014, 04:13 AM
|
#4
|
LQ Addict
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841
|
Have you run smartctl on the drive?
|
|
|
11-26-2014, 11:50 AM
|
#5
|
LQ Veteran
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,176
Original Poster
|
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.
|
|
|
All times are GMT -5. The time now is 06:08 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|