LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 01-31-2019, 09:25 AM   #46
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212

Quote:
Originally Posted by zavmat View Post
It seemed unnecessary to me, I defer to your guys' experierience on this though. Have you had a chance to take a look at the log files?
I'm looking right now. This is going to take a while.
 
1 members found this post helpful.
Old 01-31-2019, 02:13 PM   #47
zavmat
Member
 
Registered: Oct 2018
Posts: 184

Original Poster
Rep: Reputation: Disabled
Thanks for taking the time, I really appreciate it.
 
Old 01-31-2019, 04:38 PM   #48
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.
Code:
#!/bin/bash
Disk=${1:-/dev/sda}
trap '[ $Dev ] && losetup -d $Dev' 0
while read Start End Len Kproc
do
    BStart=$((Start*512))
    BLen=$((Len*512))
    Dev=$(losetup -f --show -o $BStart --sizelimit $BLen $Disk) || break
    echo $Dev $Start $Len
    $Kproc -n $Dev
    losetup -d $Dev
    Dev=""
done <<EOF
2048	   411647     409600    fsck.vfat
673792	   552939512  552265721 ntfsfix
552939519  1105205239 552265721 ntfsfix
1094012926 1400688637 306675712 fsck.ext4
1360289793 1412718592 52428800  fsck.ntfs
1400688640 1412714479 12025840  file -s
1412718592 1465147391 52428800  ntfsfix
EOF

Last edited by rknichols; 01-31-2019 at 04:40 PM.
 
1 members found this post helpful.
Old 01-31-2019, 07:30 PM   #49
zavmat
Member
 
Registered: Oct 2018
Posts: 184

Original Poster
Rep: Reputation: Disabled
Here's the result:

Code:
[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.
 
Old 02-01-2019, 10:38 AM   #50
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.
 
1 members found this post helpful.
Old 02-01-2019, 11:35 AM   #51
zavmat
Member
 
Registered: Oct 2018
Posts: 184

Original Poster
Rep: Reputation: Disabled
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.

Last edited by zavmat; 02-01-2019 at 11:37 AM.
 
Old 02-01-2019, 01:47 PM   #52
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.
 
Old 02-01-2019, 01:49 PM   #53
zavmat
Member
 
Registered: Oct 2018
Posts: 184

Original Poster
Rep: Reputation: Disabled
rebooting now
 
Old 02-01-2019, 02:04 PM   #54
zavmat
Member
 
Registered: Oct 2018
Posts: 184

Original Poster
Rep: Reputation: Disabled
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).
 
Old 02-01-2019, 03:30 PM   #55
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.

Sorry that things didn't work out better.
 
Old 02-01-2019, 03:52 PM   #56
zavmat
Member
 
Registered: Oct 2018
Posts: 184

Original Poster
Rep: Reputation: Disabled
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.

Last edited by zavmat; 02-01-2019 at 05:06 PM.
 
Old 02-02-2019, 08:39 AM   #57
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.
 
Old 02-02-2019, 11:05 AM   #58
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
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?
 
Old 02-02-2019, 01:02 PM   #59
zavmat
Member
 
Registered: Oct 2018
Posts: 184

Original Poster
Rep: Reputation: Disabled
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.
 
Old 02-02-2019, 01:17 PM   #60
igadoter
Senior Member
 
Registered: Sep 2006
Location: wroclaw, poland
Distribution: many, primary Slackware
Posts: 2,717
Blog Entries: 1

Rep: Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625Reputation: 625
I am afraid not. Let me see this: issue these commands, post here what the will show
Code:
$ lscpu
$ lsdev
$ lsscsi
order does not matter. These commands provide information about hardware: processor unit, graphic card, disk and some others.
 
  


Reply

Tags
fdisk, partitions



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
deleting duplicate lines without deleting first instance of the duplicated line jkeertir Linux - Newbie 2 02-07-2011 06:55 AM
I need help with deleting partitions, please.. the snucka Linux - Software 4 01-13-2005 03:28 PM
help with deleting partitions please the snucka Linux - General 1 01-13-2005 03:17 PM
Help with deleting partitions please... the snucka Linux - Hardware 1 01-13-2005 03:17 PM
Partitions, partitions, partitions..... Clueless in VA Linux - Newbie 7 08-08-2001 03:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:02 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