Deleting your swap - the hard way
A default clean install usually doesn't fit me. However, I've installed Ubuntu LTS just like that on this machine when both were new. It has a small but fast SSD. It has been working flawlessly until now.
I've recently reconsidered that I could use a bit more space. From experience, I never had a need for swap, as I'm using zram. So I've decided to simply delete the swap partition.
Of course, solving it simply was only my dream. Technically, you need to delete the swap partition, optionally move middle partitions to the end, expand your root file system and be done with it. I've first made whole disk backups. I've booted off a flash drive containing Ubuntu 12.10. Deleting the partition with GParted was a breeze, as well as marking the rest of the needed operations, move and resize. But there was a catch: it bailed out with a cryptic message halfway. (I think it was "GNU Parted cannot resize this partition to this size. We're working on it!")
After wasting a lot of time trying to point to any errors that I made myself, I came to understood the situation better. The default Ubuntu install seemed to have created the following partitions in GPT:
Again this situation sounds a bit silly, and after wasting some more time trying to use a supported solution like parted from command line and fudging, I've resorted to the following kludge:
That's following well supported default configurations to protect against headaches for you.
I've recently reconsidered that I could use a bit more space. From experience, I never had a need for swap, as I'm using zram. So I've decided to simply delete the swap partition.
Of course, solving it simply was only my dream. Technically, you need to delete the swap partition, optionally move middle partitions to the end, expand your root file system and be done with it. I've first made whole disk backups. I've booted off a flash drive containing Ubuntu 12.10. Deleting the partition with GParted was a breeze, as well as marking the rest of the needed operations, move and resize. But there was a catch: it bailed out with a cryptic message halfway. (I think it was "GNU Parted cannot resize this partition to this size. We're working on it!")
After wasting a lot of time trying to point to any errors that I made myself, I came to understood the situation better. The default Ubuntu install seemed to have created the following partitions in GPT:
- sda1 root (ext4)
- sda2 500MB boot (ext4)
- sda3 50MB EFI (FAT32)
- sda4 8GB swap (cryptswap)
Again this situation sounds a bit silly, and after wasting some more time trying to use a supported solution like parted from command line and fudging, I've resorted to the following kludge:
- deleted the swap using GParted without touching EFI
- created a new empty partition (sda4) in the beginning of the free space that is a bit larger than sda3 (EFI) to get the kind of rounding it needs
- dd bs=50M if=/dev/zero of=/dev/sda4
- dd bs=50M if=/dev/sda3 of=/dev/sda4
- deleted sda3
- recreated sda3 at the end of the drive with the size of sda4
- dd bs=50M if=/dev/sda4 of=/dev/sda3
- deleted sda4
- GParted was now happy, so I could now realign and resize both sda1 and sda2
That's following well supported default configurations to protect against headaches for you.
Comments
Post a Comment