2

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

2 Answers 2

3

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.

5
  • 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.. Jan 27, 2012 at 7:18
  • Can you check my latest picture and tell me if I re-created the swap correctly? Jan 27, 2012 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, 2012 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? Jan 27, 2012 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, 2012 at 23:48
1

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
8
  • 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.. Jan 27, 2012 at 7:17
  • Also how would I check for that reference? what command would I run to see if it was my swap? Jan 27, 2012 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. Jan 27, 2012 at 8:33
  • Can you check my latest picture and tell me if I re-created the swap correctly? Jan 27, 2012 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, 2012 at 16:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .