IncreasingSwapSize

From Studio Kousagi Wiki
Revision as of 21:39, 3 June 2015 by Job (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The initial configuration of swap space is only 32MB. this prevents successful hibernation.

Steps to change the existing configuration to a larger swap are based on recipes as for example in http://geekpeek.net/resize-filesystem-fdisk-resize2fs/

Note: editing partitions is risky! Backup first!!

  1. boot into the recovery image. This way the SSD is not mounted and free to edit
  2. reduce /dev/sda3 in size to make enough room after it using resize2fs. For instance remove 7GB in sectors at the end to fit a 6GB swap. (resize2fs /dev/sda3 225G)
  3. change the partition size of /dev/sda3 by deleting and recreating it with a reduced length (for example original minus 6*1024*1024*2 sectors)
  4. delete the existing swap partition /dev/sda2
  5. create a new partition /dev/sda2 (type 0x82) starting after /dev/sda3 until the end of the device (old end of /dev/sda3)
  6. extend the filesystem on /dev/sda3 again to fill up to the full size (resize2fs /dev/sda3)

After this the partitions are out of order, but this has not been an issue so far. It may look like:

Command (m for help): p
Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4e6f7653

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1            2048     67583     65536    32M  b W95 FAT32
/dev/sda2       475813888 488397167  12583280     6G 82 Linux swap / Solaris
/dev/sda3          133120 475813887 475680768 226.8G 83 Linux

Partition table entries are not in disk order.

Command (m for help):