Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Sometime back I bought a second PC to serve as my backup machine, but I've never managed to have it as I would like. Now I want to start over, but I've messed so much with it's disks that I'm kinda afraid to lose something on the way, thus this question.

Right now, I have a 1TB disk partitioned like this (as per GParted):

  • /dev/sda1 (ext4) 346.12Gb -> Is almost full, has an old install of Ubuntu 11.10. It no longer boots, ever since i installed Windows7 on /sda3. Everything that matters to me is tucked into /var/www/ all the rest can just go.

  • /dev/sda2 (ext4) 196.45Gb -> has an old install of 12.04 and nothing important, it's pretty much empty and also doesn't boot.

  • /dev/sda3 (ntfs) 377.97Gb -> is my boot partition with Windows 7, some important files and I'd like to keep it untouched.
  • /dev/sda4 (extended) 10.97Gb -> was created when i first installed Ubuntu, i think.

In my ideal world, I'd like to safely reinstall Ubuntu from the 12.04 liveUSB and merge sda1 and sda2 without losing any files. Is that possible? How?


DESPERATE UPDATE

Things got really ugly right now. I tried for a few days to follow Marty's advice, but something is up. I did the first part, of wiping the second partition and enlarging the first. Then I couldn't get Super Grub Disk to work. Tried from the live USB, then tried to make a USB disk for it, and it wouldn't boot. So i let it cool and returned today to the system.

To my surprise, when i booted from the Live USB and ran Install Ubuntu 12.04 LTS the program recognized thw instalation of 11.10 and offered me an option to just update it without loosing any files. I went joyfully to it.

After the update finished, booting didn't work, i got "input not supported" and booted back from the USB. Then i went to see if everything was OK, and for my desperation, i just can't find the /var/www folder where i had everything. Gparted also tells me the partition is now almost empty.

I didn't do any sav operation on the HD after this and shut it down immediately to avoid any more damage. Now i really need those files back. How can get them in the safest way possible?

share|improve this question
add comment

1 Answer 1

With Linux, most anything is possible, and not really that hard. In fact, if you do nothing but install a new version, you will probably find that the old installations will once again be bootable.

But to do what you want, I would use gparted from a live USB and delete sda2, since you don't need it. Then, if sda2 is adjacent to sda1, I'd enlarge sda1 to use the new free space, and then get the Super Grub Disk to fix the boot problem. Once that's done, you could update it to 12.04.

If you really want a clean install, you could (using gparted) reformat sda4, use the live USB to copy your /var/www from sda1 to sda4, then reformat sda1 and install 12.04 there. The install will keep your windows partition, assuming you pay attention and don't use the entire drive.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.