Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
Apparently you told testdisk to write out a new partition table, since it no longer complains about no GPT or alternate GPT. No harm done.
There are multiple conflicting candidates, and I can't figure out which ones represent legitimate filesystems. It looks like that disk has gone through several repartitionings, and there are old filesystem headers scattered here and there.
Here is a script that you need to paste into a file and then execute with a shell. If you call the file "chkparts", then you just need to run "bash chkparts". The script will test 7 regions of the disk looking for valid filesystems. Post the result. Hopefully there will be a non-overlapping set there.
[liveuser@localhost-live Desktop]$ sudo bash chkparts.txt
/dev/loop3 2048 409600
fsck.fat 4.1 (2017-01-24)
There are differences between boot sector and its backup.
This is mostly harmless. Differences: (offset:original/backup)
65:00/01
Not automatically fixing this.
/dev/loop3: 236 files, 29388/100352 clusters
/dev/loop3 673792 552265721
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/loop3 was processed successfully.
/dev/loop4 552939519 552265721
Mounting volume... ntfs_mst_post_read_fixup_warn: magic: 0x00000001 size: 1024 usa_ofs: 18311 usa_count: 0: Invalid argument
Record 0 has no FILE magic (0x1)
Failed to load $MFT: Input/output error
FAILED
Attempting to correct errors... ntfs_mst_post_read_fixup_warn: magic: 0x00000001 size: 1024 usa_ofs: 18311 usa_count: 0: Invalid argument
Record 0 has no FILE magic (0x1)
Failed to load $MFT: Input/output error
FAILED
Failed to startup volume: Input/output error
Checking for self-located MFT segment... ntfs_mst_post_read_fixup_warn: magic: 0x00000001 size: 1024 usa_ofs: 18311 usa_count: 0: Invalid argument
OK
Unrecoverable error
Volume is corrupt. You should run chkdsk.
No change made
/dev/loop3 1094012926 306675712
e2fsck 1.44.3 (10-July-2018)
ext2fs_open2: Bad magic number in super-block
fsck.ext4: Superblock invalid, trying backup blocks...
fsck.ext4: Bad magic number in super-block while trying to open /dev/loop3
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem. If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
or
e2fsck -b 32768 <device>
/dev/loop3 1360289793 52428800
/dev/loop4 1400688640 12025840
/dev/loop4: Linux/i386 swap file (new style), version 1 (4K pages), size 1503231 pages, no label, UUID=61ad5052-79e3-4c26-b8c2-77698654e148
/dev/loop3 1412718592 52428800
Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/loop3 was processed successfully.
It looks like the Windows partitions have been located. At this point I don't see any recoverable Linux partitions. testdisk seems to have recovered the Windows partitions, but the type codes need to be changed. Using fdisk, change the type code for partition 1 to "1" (EFI System) and the code for partition 2 to "14" (Windows recovery environment).
Code:
[root@localhost-live ~]# fdisk /dev/sda
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): t
Partition number (1-4, default 4): 1
Partition type (type L to list all types): 1
Changed type of partition 'Microsoft basic data' to 'EFI System'.
Command (m for help): t
Partition number (1-4, default 4): 2
Partition type (type L to list all types): 14
Changed type of partition 'Microsoft basic data' to 'Windows recovery environment'.
Command (m for help): p
Disk /dev/sda: 698.7 GiB, 750156374016 bytes, 1465149168 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
Disklabel type: gpt
Disk identifier: C90A303D-64AB-42B0-AD65-723707EA45E5
Device Start End Sectors Size Type
/dev/sda1 2048 411647 409600 200M EFI System
/dev/sda2 673792 552939512 552265721 263.3G Windows recovery environment
/dev/sda3 559239519 1105205239 545965721 260.3G Microsoft basic data
/dev/sda4 1360289793 1412718592 52428800 25G Microsoft basic data
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost-live ~]#
Hopefully, that will allow the Windows installation to boot. I'm not sure whether it's worthwhile trying to dig out Linux partitions. It doesn't appear that testdisk found anything else that it was happy with.
Thank you. When I type p, after /dev/sda1 through /dev/sda4 I get in red "Partition 3 does not start on physical sector boundary." followed by "Partition 4 does not start on physical sector boundary."
Should I still continue with the w command?
also /dev/sda2 and /dev/sda3 are the same exact size with the same sectors:
Code:
Device Start End Sectors Size Type
/dev/sda1 2048 411647 409600 200M EFI System
/dev/sda2 673792 552939512 552265721 263.3G Windows recovery environment
/dev/sda3 552939519 1105205239 552265721 263.3G Microsoft basic data
/dev/sda4 1360289793 1412718592 52428800 25G Microsoft basic data
Partition 3 does not start on physical sector boundary.
Partition 4 does not start on physical sector boundary.
Yes, they are the same size. No, they are not the same sectors. There is an 8-sector gap between partitions 2 and 3. Regarding the misalignment, I had not seen any previous indication that this drive had 4KB physical sectors. However, the filesystems are where they are. How they got that way I have no idea. (Is this perhaps a replacement drive in this machine?) The effect of the misalignment will be very poor write performance in those partitions, but everything should work. Once things are working again we can think about correcting the alignment problem, but for now just do the write and see if Windows will boot.
No luck booting into windows, but one noticeable change is that now saves my boot list priority instead of reverting back to Windows boot manager upon reboot. When I try to boot from the windows boot manager it goes to a blue recovery screen that says to press enter to try again f2 to enter recovery and f8 to change boot settings (or something like that).
Alas, I am by no means an expert on Windows boot problems. Unless someone else wants to chime in here, you will probably get more help from a Windows group.
Though I'm pretty sure the partitions we did find are correct, it seems the disk was already in a strange condition with misaligned and oddly located partitions even before the GPT got overwritten. That really complicates recovery, and can make testdisk miss things. I'm guessing from your previous comments that the Linux installations were a lower priority and perhaps not worth my spending more time trying to find them.
No worries, I'm just grateful that you spent the time to help me out with all this. Don't worry about the other linux installations, they were mostly outdated versions of Fedora and RHEL. It just came to me that some background information might have been useful.
First I installed Fedora 22 by following the install to hard drive application on the live linux CD. In the Device Selection menu there was only 2 gigabytes of free space, so I had to take it from another location. Where I took it from was Windows I believe and I took about 200GiB of storage space thinking that whatever space I took would be the space allowed for anything downloaded from the Fedora side of the Dual Boot system.
I learned that Fedora 22 was very outdated, so I began to update, first to 23 then 24 etc. until I decided at the suggestion of someone on here to just make a live USB of Fedora 29 and upgrade the system and that "It would override any older versions of Fedora" (Paraphrasing). Something happened, that made it so I couldn't get past the login screen, so I ran the live disk again and installed it again thinking that it would just override it.
Then I set out to delete the old partitions and that's where you caught me a moment too late unfortunately.
If you have any personal data that you want to recover from that Windows installation, you might be able to dig it out from one of those NTFS partitions. Look for a top level directory "Users". Your data would be under that.
Otherwise, given the state that the disk is currently in, that suggestion to wipe the disk is sounding more appropriate, "dd if=/dev/zero of=/dev/sda bs=256k". That will take several hours. That 256k block size is fairly arbitrary -- for speed, you just want something a lot bigger than the default 512 bytes. If you then want to reinstall Windows and don't have an installation disk, you can download an ISO file from https://www.microsoft.com/en-us/soft...d/windows10ISO. You can install without a product key. If Windows had previously been activated on that machine, Microsoft will recognize that and automatically activate the new installation.
I suspect you are doing something nasty on someone else computer and ask us for help. Evidently you have no knowledge to create setup as on fdisk listing. This
Code:
Command (m for help): sudo fdisk -l
is most peculiar thing I ever seen. You don't know what are you doing, don't you? So how could you know how to create these partitions you want so eager to delete?
You got me! Just kidding, I am completely new to this. I do not like windows, My laptop has not worked properly since windows 10. The power cable is broken, and on windows it cycles from plugged to unplugged until the battery is drained. Linux has been able to fix this problem. I have no prior experience in terminal or gnome and although I am eager to learn, I frankly do not know where to begin. Before I wipe the disk, however, I want to know if it is possible to retrieve files from the Windows operating system onto Fedora. I did not back them up because I do not have an external hard drive.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.