Linux - GeneralThis 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
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.
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.
It's been a long time since I posted here and I guess that's a fine testament to just how incredibly stable my Linux desktop 'workhorse' has been
Sadly all that ended a couple of weeks ago when we experienced an unusually violent lightning storm (well at least by UK standards!) and the motherboard was zapped. The system was a dual boot Kubuntu 10.04 with winXP. When I rebuilt the machine with a new motherboard and after checking my disk still worked + had all its data by connecting it as a slave on another system I discovered that only XP would boot.
So, here's the steps so far:
Run bootable live CD and accept its invitation to repair boot. Stupidly I do not know what CD this was and cannot now find it - don't shout, such is my life !!!
Discover that Kubuntu will now boot but XP will not. Not overly concerned as don't need XP right at that time...
Am not worried until a couple of days later Kubuntu fails to boot and says there's something wrong with the disk - hit a key to repair - which I do. Kubuntu boots but I am now concerned.
I run gparted which is not happy, showing the entire disk as unallocated and when run in a terminal:
parted /dev/sda print
Error: Cannot have overlapping partitions.
Device Boot Start End Blocks Id System
/dev/sda1 * 1 6092 48933958+ 7 HPFS/NTFS
/dev/sda2 6093 24320 146416410 f W95 Ext'd (LBA)
/dev/sda3 24194 24320 1020096 e W95 FAT16 (LBA)
/dev/sda5 6093 23630 140873922 83 Linux
/dev/sda6 23631 24193 4522266 82 Linux swap / Solaris
I'm far from expert here but I can see that the partition table is not right but I lack the confidence to go further and need you folk to guide me through the next steps. I would like to recover some order to the Linux partitions and of course restore the XP to full functionality even though I only have one CAD program on there I will desperately need to use it soon...
Thanks all,
Steve.
Last edited by weebo; 08-03-2015 at 12:01 PM.
Reason: title clarity
If you are still using Kubuntu 10.4, support for it ended two years ago. You might try to upgrade or install something newer.
Have you tried just running: sudo update-grub to see if xp is added?
Yes, XP is on grub's list - grub goes to XP and I see a splash screen briefly but it fails to boot. Please correct me if I am wrong but the partition table looks to have some illegal overlaps in it and I am almost certain that this is the problem.
I realise that 10.04 is old but it was extremely stable and did not bloat out my modest system. Presumably if I went for a re-install or upgrade, due to the broken partition table the re-install process would not recognise the existing XP installation or for that matter my 10.04. Due to the difficulty installing XP and running updates these days I would like to avoid doing that if I can.
I would simply like to get back to where I was by repairing the partition table if that is possible.
Steve.
Last edited by weebo; 08-03-2015 at 01:13 PM.
Reason: typo
It looks to me like the only problem is an incorrect ending location for the extended partition (partition 2). Please post the output from "fdisk -l -u /dev/sda". That will show sector units. Showing cylinder units is too imprecise. Also post the output from "sfdisk -d /dev/sda" and "file -s /dev/sda?"
Please wrap all that output in [CODE] ... [/CODE] tags to preserve formatting. Let's see what this looks like.
It looks to me like the only problem is an incorrect ending location for the extended partition (partition 2). Please post the output from "fdisk -l -u /dev/sda". That will show sector units. Showing cylinder units is too imprecise. Also post the output from "sfdisk -d /dev/sda" and "file -s /dev/sda?"
Please wrap all that output in [CODE] ... [/CODE] tags to preserve formatting. Let's see what this looks like.
Thanks for this.
As you request:
output from fdisk -l -u /dev/sda
Code:
~$ sudo fdisk -l -u /dev/sda
omitting empty partition (5)
Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders, total 390721968 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc8afc8af
Device Boot Start End Blocks Id System
/dev/sda1 * 63 97867979 48933958+ 7 HPFS/NTFS
/dev/sda2 97867980 390700799 146416410 f W95 Ext'd (LBA)
/dev/sda3 388660608 390700799 1020096 e W95 FAT16 (LBA)
/dev/sda5 97868106 379615949 140873922 83 Linux
/dev/sda6 379616013 388660544 4522266 82 Linux swap / Solaris
Somehow your code tags got taken literally. What did you do, include the "noparse" tags that I used to make them show up as text? Oh well, no great loss.
I think I see what happened. That 1GB FAT16 partition that is currently showing up as primary partition 3 should be logical partition 7 at the end of the extended partition. Recovery is going to be a bit more risky than I like to advise without a full backup of the disk image to another device. What I would do is use fdisk to simply delete partition 3. That should leave you with a consistent partition table, but with one lost partition. You can then see if testdisk can find and recover the missing partition.
Of course, if that 1GB partition was just a recovery partition that came with the machine, then you probably don't want it anyway.
I guess in my naivety I did take you literally and copied the noparse tags you used but, as you see, I have rectified that.
I cannot imagine what is on the 1GB FAT16 partition, it may be a recovery partition from the original machine's setup I don't know - I was given the machine by a friend who no longer used it, I seem to remember reformatting the disk when I got the machine but it was a good few years ago!
I have a 1Tb external usb drive which I shall make an image of the disk on, that seems like a very good thing to do anyway. . Do you know of any particularly good imaging software to use? I have just been reading about Clonezilla...
As one relatively unfamiliar with fdisk would you be kind enough to take me through the steps necessary to delete the 1GB FAT16 partition?
Thanks for your help here - much appreciated!
Steve.
I would not recommend clonezilla or any "smart" imaging tool to copy a drive with known structure errors. I would just make a partition at least 200GB in size and use dd to copy the source drive to it, byte-for-byte. Assuming your new partition is /dev/sdb1, that would be
Code:
dd if=/dev/sda of=/dev/sdb1 bs=1M
That should be done while booted from a rescue disk so that no partitions on the source drive are mounted. Be absolutely sure you get the source ("if=") and destination ("of=") parameters correct, since dd will be quite happy to copy the empty new drive back to the original. The "bs=1M" parameter is fairly arbitrary. You just want a blocksize a good deal larger than the default 512 bytes for efficiency.
BTW, that command is going to take a few hours to complete, quite a few if that new drive is on a USB 2.0 interface.
Using fdisk to delete partition 3 is straightforward. You just need the "d" command, then the partition number, then "w" to write out the result and exit. I've put the part you type in red.
Code:
# fdisk /dev/sda
.
.
.
Command (m for help): d
Partition number (1-4): 3
Command (m for help): w
Again, be sure you're working on the right disk, though a mistake there is fairly easy to recover from.
Thanks for this, it'll likely take me a day or two to make the time to do this properly so, if you will bear with me I'll post back as soon as possible with some results.
There is no real good way to be sure your data is correct at this point. It is has not been a common issue for a very long time to have overlapping partitions. Assume your data is damaged and consider clean installs.
There are not actually any overlapping partitions. There is a primary partition that is using space that is within the container that is the extended partition, but there is no overlap of any actual data partitions.
Ubuntu default partitioning back then would have been to have the swap as a logical by itself - and thus the root partition as a primary.
Also, I would not be surprised to see an old XP machine with the XP partition at the beginning of the disk (/dev/sda1), and a tools/recovery partition at the end of the disk (/dev/sda2). That might be a logical or not depending on the vendors setup - I've seen both.
If it were me, I'd delete the extended partition altogether just to get things going. If the swap caused a failure on boot (say "resume=..."), I'd delete that too, and fix up the boot parms and fstab. All after a decent backup of course.
The swap can be added back anytime, but this may be more fiddly than the OP is comfortable with.
If it were me, I'd delete the extended partition altogether just to get things going. If the swap caused a failure on boot (say "resume=..."), I'd delete that too, and fix up the boot parms and fstab.
Note that Linux is on logical partition sda5 within the extended partition, so you'd be deleting that, too. Loss of the swap partition would be immaterial.
A recovery partition, if that's what was on what is now sda3, is not likely to be useful. It would probably restore Windows XP to a state so out of date that Windows Update would not work to bring the installation up to the final, EOL version. I ran into that on the only two occasions when I tried it. There's a list of a half dozen or so of updates you have to download and install manually to get Windows Update to work again. And, of course, you'll have to deal with all the bloatware that originally came on the machine. You'd have to be pretty desperate for a fresh XP install to go that route.
Note that Linux is on logical partition sda5 within the extended partition, so you'd be deleting that, too.
No, that's the fun part.
Because of the initial install as a primary, it has an entry in the partition table, so will be found ok. fdisk shows it as a logical because of the existence of that extended. Bad assumption on the (fdisk and parted too I think) coders part.
It all works ok for this particular arrangement - if my assumption was right. I have done it, and it has worked.
After a backup.
"I run gparted which is not happy, showing the entire disk as unallocated and when run in a terminal:
parted /dev/sda print
Error: Cannot have overlapping partitions."
I've had issues before like this. Yes, it may be possible to correct the barriers but you don't know what data may have had some reference to those spots.
It is possible that a very old program made the issue and has been like this for years.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.