easimon / maximize-build-space

Github action to maximize the available disk space on Github runners

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mine got minimized hahaha

Revolution1 opened this issue · comments

runs-on: ubuntu-latest

0s
Run df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        84G   53G   31G  63% /
devtmpfs        3.4G     0  3.4G   0% /dev
tmpfs           3.4G  4.0K  3.4G   1% /dev/shm
tmpfs           695M  1.1M  694M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.4G     0  3.4G   0% /sys/fs/cgroup
/dev/loop0       64M   64M     0 100% /snap/core20/1623
/dev/loop2       68M   68M     0 100% /snap/lxd/22753
/dev/loop1       48M   48M     0 100% /snap/snapd/16778
/dev/sda15      105M  5.2M  100M   5% /boot/efi
/dev/sdb1        14G  4.1G  9.0G  31% /mnt
tmpfs           695M     0  695M   0% /run/user/1001
8s
Run easimon/maximize-build-space@master
  with:
    root-reserve-mb: 512
    swap-size-mb: 1024
    remove-dotnet: true
    remove-android: true
    remove-haskell: true
    temp-reserve-mb: 100
    overprovision-lvm: false
    pv-loop-path: /pv.img
    tmp-pv-loop-path: /mnt/tmp-pv.img
  env:
    CARGO_TERM_COLOR: always
Run echo "Memory and swap:"
  echo "Memory and swap:"
  free
  echo
  swapon --show
  echo
  
  echo "Available storage:"
  df -h
  echo
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    CARGO_TERM_COLOR: always
Memory and swap:
              total        used        free      shared  buff/cache   available
Mem:        7110660      550796     5335396       12680     1224468     6247452
Swap:       4194300           0     4194300

NAME          TYPE SIZE USED PRIO
/mnt/swapfile file   4G   0B   -2

Available storage:
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        84G   53G   31G  63% /
devtmpfs        3.4G     0  3.4G   0% /dev
tmpfs           3.4G  4.0K  3.4G   1% /dev/shm
tmpfs           695M  1.1M  694M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.4G     0  3.4G   0% /sys/fs/cgroup
/dev/loop0       64M   64M     0 100% /snap/core20/1623
/dev/loop2       68M   68M     0 100% /snap/lxd/22753
/dev/loop1       48M   48M     0 100% /snap/snapd/16778
/dev/sda15      105M  5.2M  100M   5% /boot/efi
/dev/sdb1        14G  4.1G  9.0G  31% /mnt
tmpfs           695M     0  695M   0% /run/user/1001

Run set -euo pipefail
Arguments:

  Root reserve:      512 MiB
  Temp reserve:      100 MiB
  Swap space:        1024 MiB
  Overprovision LVM: false
  Mount path:        /home/runner/work/XXXXX/XXXXX
  Root PV loop path: /pv.img
  Temp PV loop path: /mnt/tmp-pv.img
  Removing:     dotnet android haskell 
Removing unwanted software... 
... done
Unmounting and removing swap file.
Creating LVM Volume.
  Creating LVM PV on root fs.
  Physical volume "/dev/loop3" successfully created.
  Creating LVM PV on temp fs.
  Physical volume "/dev/loop4" successfully created.
  Volume group "buildvg" successfully created
Recreating swap
  Logical volume "swap" created.
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=3a88015a-c8d7-412d-b453-14790523aa4d
Creating build volume
  Logical volume "buildlv" created.
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 14713856 4k blocks and 3679200 inodes
Filesystem UUID: f54aed80-8c13-4e70-993f-967be6f29c96
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
	4096000, 7962624, 11239424

Allocating group tables:   0/450�������       �������done                            
Writing inode tables:   0/450�������       �������done                            
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information:   0/450�������       �������done

Run echo "Memory and swap:"
Memory and swap:
              total        used        free      shared  buff/cache   available
Mem:        7110660      589880     5117596       12688     1403184     6208616
Swap:       1048572           0     1048572

NAME      TYPE       SIZE USED PRIO
/dev/dm-0 partition 1024M   0B   -2

Available storage:
Filesystem                   Size  Used Avail Use% Mounted on
/dev/root                     84G   83G  512M 100% /
devtmpfs                     3.4G     0  3.4G   0% /dev
tmpfs                        3.4G  4.0K  3.4G   1% /dev/shm
tmpfs                        695M  1.1M  694M   1% /run
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        3.4G     0  3.4G   0% /sys/fs/cgroup
/dev/loop0                    64M   64M     0 100% /snap/core20/1623
/dev/loop2                    68M   68M     0 100% /snap/lxd/22753
/dev/loop1                    48M   48M     0 100% /snap/snapd/16778
/dev/sda15                   105M  5.2M  100M   5% /boot/efi
/dev/sdb1                     14G   13G  100M 100% /mnt
tmpfs                        695M     0  695M   0% /run/user/1001
/dev/mapper/buildvg-buildlv   55G   24K   55G   1% /home/runner/work/XXXXX/XXXXX

From what I see, the action worked as intended. It took all but the configured reserves, created a logical volume from that space, and mounted that back to the runner's home, /home/runner/work/XXXXX/XXXXX, where all the build action usually takes place.

This run started with 33GB free on / (which is where /home/runner/work/XXXXX/XXXXX is located initially) and ended with 55GB free in that directory. Of course, this is at the expense of free space on root and temp disk.

If your build requires the space at another location (or more space left on /), you can configure that.

Closing this issue, since I assume no error. Feel free to reopen with more details if you think there's something wrong.