Yikes, it's been a long day. I had a dual boot of Windows 10 and Ubuntu and everything was good but I was running out of space in Ubuntu. I attempted to shrink my windows 10 partition but because of "unmovable" files I was not able to shrink it. Searched forums and I found the utility "AOMEI Partition assistant"... it shrank my windows 10 partition no problem, but now when I boot I just get a grub> prmompt. If I had esc during boot I can choose to boot into windows 10 which seems to work fine. I opened up the partition manager in windows 10 and to my horror my Ubuntu partition is simply gone and it's space and the space I freed from Windows 10 just says "Unallocated space". Is there any chance my data is still lurking in there somewhere? Any hope for repair? I'm looking at losing 100+ hours of work. I'm going to lie on the floor and cry for a while.
-
1MBR(msdos) partitioning? Windows since Windows 7 & its partition tools have a bug where they conveniently forget to include Linux partitions back into partition table. Usually data is still there and you just need to restore missing entry in partition table. But of course you did make good backups of both Windows & Ubuntu as partition changes are a major change. You should be able to use testdisk or parted rescue. Parted rescue seems easier than testdisk https://askubuntu.com/questions/665445/upgraded-to-windows-10-on-dual-boot-and-cant-boot-to-ubuntu-partition – oldfred Aug 06 '19 at 22:50
-
Thanks, you've given me a glimmer of hope. How do I figure out the start and end, do I use gparted? In gparted the "unallocated space" starts with 529213230 and last sector is 974665727. Parted doesn't find anything in that range but it does say it's using /dev/sda, where as gparted says it's looking at /dev/nvme0n1. There's probably a command to change to that I bet. – Patrick Man Aug 06 '19 at 23:16
-
I wasn't able to quite get the partition found with parted rescue but when I tried testdisk it did indeed find the partition and allowed me to view the files. I put the start and end sectors listed by testdisk into parted rescue and voila, could view and copy the lost files. I then installed and ran boot-repair and was finally able to boot into my old Ubuntu. Thank you SO MUCH, Oldfred, you may saved me getting fired. I'm week 2 into a new web developer job and "I need some time to rebuild my dev enviro" might have been a showstopper. – Patrick Man Aug 07 '19 at 00:40
-
1Time to review all the answers, threads, & posts on backup. And if a developer, you should be using Source Control. See: https://www.joelonsoftware.com/2000/08/09/the-joel-test-12-steps-to-better-code/ – oldfred Aug 07 '19 at 03:35
1 Answers
I had the exact same problem and solved the problem in the following way.
Create a live USB with an Ubuntu version, e.g. Ubuntu 20.04, and run Ubuntu on that USB (see https://linuxhint.com/run_ubuntu_usb_stick/ for details).
Open a terminal and look at the current partition table:
sudo parted /dev/sda unit s print //this printed the current partition table
In case your partition is still missing, you can rescue it by using parted, but you need to know the Start and End Sector of your missing partition. Therefore install TestDisk:
sudo apt update sudo apt install testdisk
If this is not working, make sure that in Software & Updates -> Ubuntu Software the Community-maintained free and open-source software (universe) option is ticked and try it again.
Run TestDisk:
sudo testdisk
Chose Create, then the hard disk where your partition is missing, chose the partition table which is automatically detected and select Analyze. It will the print a list of partition which should include your lost partition. Write down the Start and End Sector of your recovered partitions. (visit https://www.tecmint.com/install-testdisk-data-recovery-tool-in-linux/ for more details)
Then use parted to rescue the lost partition by using the Start and End Sector information. Repeat the process if you have several lost partitions (e.g. root and swap).
sudo parted unit s rescue Start? //Here I entered in start section End? //Here I entered in end section
Then your partition(s) should be recovered and you can use GParted to allocate the freed space to your partition (visit https://www.howtogeek.com/114503/how-to-resize-your-ubuntu-partitions/ for more details). Keep working on the live USB, as a partition in use can't be modified in any way.

- 114,770