Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

so I am using ubuntu 11.10, just changed from windows to ubuntu, and one of my file systems, I accidentally set it up as a linux swap partition and now I want to acces my files, as I did in windows, but I do not know any secure way to change that partition to a file system without formating it and loosing the data.

Because I do not want to loose the data I have there. Does deleting the partition and mounting it again solve the problem?

share|improve this question
I'm not sure I understand your question... did you previously have it as a FAT32 or NTFS partition and format it as Linux Swap? If that's the case the data probably was erased, because Swap is kind of like the windows pagefile... it doesnt contain any data, just more like overflow for after your RAM has been used up. – Thomas Ward Nov 30 '11 at 16:17

Swap in Linux is not the same as swap file in windows. In Linux swaps take over partitions, not files.

If you assign a previous existing file system as swap Linux formatted it for that purpose, your data will be lost.

If that is the case it will be really hard (if not impossible) to get it back.

share|improve this answer
You can use swap files on Linux too if you don't want to use a swap partition. This can be done using the swapon and swapoff commands. – Anonymous Nov 30 '11 at 17:28
True, unfortunately that is not the default procedure for "normal" installation. – Bruno Pereira Dec 3 '11 at 8:55

If OS don't have sufficient RAM memory to handle programs and self, then it will use swap partition/file/space as a replacement.

After swap space is allocated, it must be formatted (initialized) with swap header information. This only needs to be done one time.

So I think you won't back your data.

share|improve this answer

yes, yes you can..a friend and i just did it tonight after a 5 google hour search. TestDisk is the it and follow the instructions on the bottom of the following page

we opted not to select the write option, just to be on the safe side..alternatively, we decided to copy the "lost" files to an external hard drive. hope it helps!!

share|improve this answer

Your Answer


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.