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

Much to my surprise I recently found myself to lack a swap partition.

Since (as is evident from the output of df, which I hereby repost) that I am running off a single encrypted volume, I was wondering how I can safely go about resizing everything and creating an 8 GB partition for use as a swap (and enabling it's use). I seem to remember that the scheme I opted for during installation is LUKS.

user@host:~$ df
Filesystem                  1K-blocks     Used Available Use% Mounted on
/dev/mapper/ubuntu--vg-root 237978256 14144120 211722472   7% /
none                                4        0         4   0% /sys/fs/cgroup
udev                          3829132        4   3829128   1% /dev
tmpfs                         3844736     2060   3842676   1% /tmp
tmpfs                          768948     1324    767624   1% /run
none                             5120        0      5120   0% /run/lock
none                          3844736    32312   3812424   1% /run/shm
none                           102400       28    102372   1% /run/user
tmpfs                         3844736        0   3844736   0% /var/spool
tmpfs                         3844736       24   3844712   1% /var/tmp
tmpfs                         3844736      936   3843800   1% /var/log
/dev/sda1                      240972    84550    143981  37% /boot
/home/user/.Private        237978256 14144120 211722472   7% /home/user

I'm a little out of my depth and I intuit that there's ample opportunity for disaster so I'd much appreciate some assistance. (And, though I would be disappointed if I accidentally nuked the drive, this is just a personal laptop with nothing criticcal on it, so I could always start over).

share|improve this question
up vote 1 down vote accepted

There is a really nice tool called system-config-lvm, which helps guide the resizing, adding, removing and other functions of pv's and lv's of your LVM. Unfortunately, you'll run into issues trying to resize or edit an active partition.

You will need to run a Live Distribution in order to modify your SSD's partitions. You can do this with Ubuntu itself, or try out the [no-longer free] partedmagic. Parted Magic does have better features and functionality dealing with SSD/HDDs.

Once you're in a Live Distro, you'll be able to find lots of information on how to resize your partitions.

share|improve this answer
Do you suggest I create the partition for the swapfile inside the LUKS volume or aside from it? – qubex May 17 '14 at 18:26
Most importantly, set up the swap volume as a swap volume (random key each boot). Whether or not you create a completely new LVM/LUKS volume depends on what you want to accomplish. – earthmeLon May 19 '14 at 17:05
I’ve kind of succeeded in re-enabling virtual memory by providing a swap partition, but I haven’t yet succeeded in providing a swap partition that can be used for the sake of hibernation and resume (I think the memory image is being written to the swap upon hibernation but not being read at the successive power-on). – qubex May 19 '14 at 18:56

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.