# Size of AMI Images in AWS/EC2 instances



## gaudenzio (Sep 2, 2020)

Hi all,

this is my first message in this wonderful forum. Sorry for my english and sorry if it's not the right section.

I'm quite a beginner in Unix based systems. I'v had in the past my personal VPS with a with a Debian-Nginx-MariaDB system and my personal page and a few projects. Now i'm trying a new, more serious PHP project, and decided to switch to FreeBSD.

I was just wondering why the official, "out-of-the-box" FreeBSD installation in AWS is quite big (3.8Gb) in comparison with other Linux distributions.

Debian and CentOS clean installations in AWS start with about 1-1.5 Gb used disk space.

Is there any "easy" way for a beginner to shrink the base FreeBSD Installation? I already detected that usr/lib/debug alone is 1,46 Gb big.

Or maybe, could we ask for an official "lightweight" AMI as a feature request?

Best regards.


----------



## Deleted member 63539 (Sep 2, 2020)

Could it be because FreeBSD included the LLVM Clang compiler by default? These Linux usually don't include any compilers but need to install it separately via a meta-package, e.g: build-essential on Debian.


----------



## gaudenzio (Sep 8, 2020)

I don't know actually, but if I run the command `du -h usr/lib/clang`, it gives only 56M.


----------



## obsigna (Sep 8, 2020)

/usr/ports got 1 GB, however, you want to keep this. I don't remember, whether, /usr/src was in the AMI when I did my installation, in case yes, I emptied it. The FreeBSD sources account for 1.3 GB and /usr/src/ can be safely emptied, as long as you don't want to build a custom kernel or custom user land tools on the very machine.

There is a FreeBSD mailing list freebsd-cloud@freebsd.org (https://lists.freebsd.org/mailman/listinfo/freebsd-cloud) and you might want to send feature requests to this list. Colin Percival, the maintainer of the FreeBSD-AWS-AMI responded once to one of my questions on the said mailing list.


----------



## gaudenzio (Sep 8, 2020)

Thank you for your answer, obsigna.

There is no /usr/ports directory, and /usr/src/ is empty.

The largest directories I could find so far are:
/usr/lib/debug: 1.5G
/var/db/freebsd-update: 508M
These 2 directories use take alone half of the disk usage.

I think i've read somewhere that I can safely delete the debug folder as long as I don't want to use the debug functions, but I'm not sure.
And I'm afraid I'm not skilled enough to compile a custom AMI without debug.

freebsd-update could be safely emptied according to








						Solved - Is it safe to clean /var/db/freebsd-update/files ?
					

I've got 107954 files taking up almost 2G of space in the /var/db/freebsd-update/files directory, which I'm assuming are leftovers from performing freebsd-update during the various FreeBSD 10-RC upgrades. Is it safe to remove these?  With the ability to rollback an upgrade (using freebsd-update...




					forums.freebsd.org


----------



## gaudenzio (Sep 8, 2020)

I wanted to make a comparison between FreeBSD 11 and 12, launched a new Instance of FreeBSD 11 and got these quite funny results:

*FreeBSD 11:*
The FreeBSD 11 AMI size "out-of-the-box" is only 2.4G (*1.4G less than FreeBSD 12*). 
`df - h` gives:

```
Filesystem         Size    Used   Avail Capacity  Mounted on
/dev/gpt/rootfs    9.7G    2.4G    6.5G    27%    /
devfs              1.0K    1.0K      0B   100%    /dev
```

/usr/lib/debug size is 847M
/var/db/freebsd-update size is 295M

*FreeBSD 12:*
Again, for comparison purposes, the FreeBSD 12 AMI "out-of-the-box":
`df - h` gives:

```
Filesystem         Size    Used   Avail Capacity  Mounted on
/dev/gpt/rootfs    9.7G    3.8G    5.1G    43%    /
devfs              1.0K    1.0K      0B   100%    /dev
```

/usr/lib/debug size is 1.5G (650M more than FreeBSD 11)
/var/db/freebsd-update size is 508M (213M more than FreeBSD 11)


----------

