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.

EDIT $3 Looks like it already saved my swap even without editing fstab. take a look:

Same Swap

EDIT #2: Alright - rebooted and this is what I got, let me know if I did everything correctly:

Swap-edit 2

EDIT #1: Alright, recreated swap, let me know if I did it right, also, I right clicked and hit "swapon" as well - here's what I got:

new-swap

partitions

I'm not sure what all filesystems my Harddrive was supposed to have after Linux build them, but something I did the other day, until recently, the Unallocated partition you see before you said "Unknown" and had a red circle by it. It had just appeared there after I did something on accident with another program trying to format my other partition

share|improve this question

2 Answers 2

up vote 3 down vote accepted

That was likely either a Manufacturer's Recovery Partition (unlikely since you installed Linux over it and because it is in an extended partition)

More likely it was being used as swap space, as that is traditionally stored as the last partition on a disk, and is often in an extended partition.

To turn it back into swap, first right click on the unallocated space and select "New" then change the "File System:" box to "linux-swap". Leave everything else alone. Apply the change, the right click it and select 'swapon'

Edit: The 'swapon' is only until you shutdown, to make it permanent you need to edit /etc/fstab to include the uuid (long character string) from the output of ls -l /dev/disk/by-uuid | grep /dev/sda5. You can do this with nano /etc/fstab (works just like a regular editor, press CTRL+X to save and quit.

share|improve this answer
    
I think its just a partition under the extended - if it was my swap. Are you sure I haven't lost anything really important? How can I tell if it was the swap or not? is ubuntu going to need to be reinstalled because of this? I'm kinda concerned now... that maybe I deleted something really important.. –  Alex Poulos Jan 27 '12 at 7:18
    
Can you check my latest picture and tell me if I re-created the swap correctly? –  Alex Poulos Jan 27 '12 at 15:47
    
Yeah that's correct. I should have mentioned to change the alignment to 'Cylinder' instead of 'MiB', so that you wouldn't get the wasted 1 MiB. You can rightclick it and 'Swapoff' then delete and recreated it just like before but with the opposite alignment if it bothers you. –  Huckle Jan 27 '12 at 16:35
    
I read at the Ubuntu help faqs the following quote: help.ubuntu.com/community/SwapFaq "Activating the swap partition(If your swap is on your primary hard drive, you don't need to do anything here.) - is that the case? –  Alex Poulos Jan 27 '12 at 21:54
    
I don't know if that is true, but I know how we can verify if it is. Comment out the line UUID=.... none swap sw 0 0 by putting a '#' in front of it (seems yours already has one) and then reboot. After it is booted, run swapon -s to list all the active swap partitions. If /dev/sda5 is on that list, then no entry in /etc/fstab is needed. –  Huckle Jan 27 '12 at 23:48

If GParted is saying that space is unallocated, then there is no partition covering that portion of the hard drive. If it said "unknown" previously, then you most likely deleted a partition.

As for what might have been there, one possibility is that it was your swap partition. One way to check this is to look for a reference in /etc/fstab (e.g. a comment like "swap was on /dev/sda5 during installation").

If this is the case, then you haven't lost any important data, but I would suggest recreating the swap partition since it lets you better utilise the resources on your computer. Once you've recreated the partition, reformat it with mkswap using the UUID found in the corresponding line of the /etc/fstab file:

mkswap -U $uuid $device
share|improve this answer
    
I think its just a partition under the extended - if it was my swap. Are you sure I haven't lost anything really important? How can I tell if it was the swap or not? is ubuntu going to need to be reinstalled because of this? I'm kinda concerned now... that maybe I deleted something really important.. –  Alex Poulos Jan 27 '12 at 7:17
    
Also how would I check for that reference? what command would I run to see if it was my swap? –  Alex Poulos Jan 27 '12 at 7:20
    
As I said, there should be a reference to the swap partition in the /etc/fstab file. If it mentions /dev/sda5 (the first extended partition), then that would be what you deleted. If a running program is not currently active, some of its memory might be written out to swap to make space for other running programs. When the program is swapped back in or exits, then the information written to swap is no longer needed. This is why I said that if you deleted your swap partition you probably haven't lost any valuable data. –  James Henstridge Jan 27 '12 at 8:33
    
Can you check my latest picture and tell me if I re-created the swap correctly? –  Alex Poulos Jan 27 '12 at 15:47
    
Run at the terminal cat /etc/fstab | grep swap and ls -l /dev/disk/by-uuid | grep /dev/sda5 to see if that partition was previously swap. If the UUID from the /etc/fstab file is not in the second output then it was indeed your swap. If that is the case, edit the fstab with sudo nano /etc/fstab and replace the uuid that is there with the one from the ls -l /dev/disk/by-uuid | grep /dev/sda5 output –  Huckle Jan 27 '12 at 16:39

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.