1

I was trying to install ubuntu, and by mistake I have changed the C partition type (where Windows is installed) to linux swap, but all the windows files and all the data i had in there still in it.

Do you guys have an idea how to reset the partition type?

1 Answers1

0

(Edit : same processes can be done through command line in recovery mode from ubuntu while booting through grub. But these would be probably temporary so repeat after logging in.)

I'm not sure if this should work never had such issue. Safest would be to re-install Ubuntu. And in case you have some files on it (which you might not I think as you just installed), you may temporarily copy those through your Windows.

Still, if it is worth the risk: Change swap

(Edit : boot to CLI in recovery mode and run swapon to see current swap location say /dev/sdaxx. Next run swapoff /dev/sdaxx, rm /etc/initramfs-tools/conf.d/resume and resume booting. Next follow the following steps in normal )

Boot through a live usb and mount your installed Ubuntu partition, I'd refer it as $IUP. In its root, find /proc/swaps and /etc/initramfs-tools/conf.d/resume. For the time being, just comment or delete everything in them. More specifically, just have to remove a line containing the name of your Windows partition; somewhat like this:

/dev/sda2                               partition       2097148 0       -1

You may change it to some other partition or a swap file, but I'd suggest to do it later. (Running swapoff /dev/sda2 does the same but in normal boot.)

The swap partition isn't mounted like the other partitions. It is usually enabled automatically during bootup if listed in the /etc/fstab file or you can use swapon.

Source: src

For added safety, you may want to edit /etc/default/grub in your $IUP :

Look for the line GRUB_CMDLINE_LINUX="resume=UUID=41e86209-3802-424b-9a9d-d7683142dab7", change it to GRUB_CMDLINE_LINUX="" and save the file.

Go through the rest process of updating (removing resume statement in /etc/initramfs-tools/conf.d/resume and all) as you may see in Change swap link above and how to do it through live usb in here

Also in /etc/fstab of the $IUP, remove the line containing the word swap in it. See here

Once again, I'm not sure this will totally work out. Still, when you boot in ubuntu, turn swapoff before anything, update-grub and update-initramfs -u and all process of removing swapping as in Change swap link. I've tried my best to be as safest as possible, if you face problems (sorry in that case), please comment.