How to reinstall Ubuntu keeping my data intact?

I want to reinstall Ubuntu keeping my data intact. I have 160 GB hardrive (sata or pata I don't know but it's slim and made in China) with a 40 GB ext3 partition, a 4GB swap memory and 3 other partition with a FAT32 file system. I have around 4GB space on my drive where Linux is installed.

I'd like to keep the data intact, especially the Downloads folder, desktop, and /var/www; And I no longer have access to any other machines or external storage devices.


Just copy the directories that you want to save i.e Downloads, /var/www and Desktop to another partition, install Ubuntu to that 40 GB ext3 partition and after installation copy the directories back.


In the installer, choose the option for advanced partitioning, then select your existing / or /home partition. In the box that appears, make sure the filesystem selected matches the existing filesystem of that partition, and that the format box is not checked. Proceed as normal through the rest of the options.

Copied from a comment by Evan on a previous Ask Ubuntu question: What's your recommendation on drive partitioning schemes for a desktop and home server?

According to the comment this will only preserve /home, /usr/local, /usr/src, and /var/local, so you will probably have to move /var/www and anything else you want to preserve into your /home directory (at least temporarily) to prevent it from being overwritten.