Building in ram

Hello ,
i try to make building in RAM . i read the Arch wiki and some other posts but not really understand and so im not sure if i make it right .
as i read on arch wiki tmpfs means using ram and standart it use the half of ram size . i have 64gb so it will use 32 GB for it what i think it will be enough to build there without problems .
if i check tmp it gives the following :

findmnt /tmp
TARGET SOURCE FSTYPE OPTIONS
/tmp   tmpfs  tmpfs  rw,nosuid,nodev,nr_inodes=409600,inode64 

as it tell me the source is tmpfs i think its in ram ?
so i change the build dir in makepkg to BUILDDIR=/tmp/makepkg

is that all i need to build in ram ?
im confused bec i also read tmpfs on arch wiki there it stand the fstab should look like this :

/etc/fstab

tmpfs /tmp tmpfs rw,nodev,nosuid,size=2G 0 0

tmpfs /www/cache tmpfs rw,size=1G,nr_inodes=5k,noexec,nodev,nosuid,uid=user,gid=group,mode=1700 0 0

my fstab look this :

UUID=8e50e065-11b1-4774-8082-1ab1ea33981e /var/tmp btrfs subvol=/@tmp,defaults,noatime,space_cache,autodefrag,compress=zstd 0 2

do i need to make change there ? im a bit afraid to change fstab

fstab

/etc/fstab: static file system information.

Use 'blkid' to print the universally unique identifier for a device; this may

be used with UUID= as a more robust way to name devices that works even if

disks are added and removed. See fstab(5).

UUID=8FFB-AA6A /boot/efi vfat umask=0077 0 2
UUID=8e50e065-11b1-4774-8082-1ab1ea33981e / btrfs subvol=/@,defaults,noatime,space_cache,autodefrag,compress=zstd 0 1
UUID=8e50e065-11b1-4774-8082-1ab1ea33981e /home btrfs subvol=/@home,defaults,noatime,space_cache,autodefrag,compress=zstd 0 2
UUID=8e50e065-11b1-4774-8082-1ab1ea33981e /root btrfs subvol=/@root,defaults,noatime,space_cache,autodefrag,compress=zstd 0 2
UUID=8e50e065-11b1-4774-8082-1ab1ea33981e /srv btrfs subvol=/@srv,defaults,noatime,space_cache,autodefrag,compress=zstd 0 2
UUID=8e50e065-11b1-4774-8082-1ab1ea33981e /var/cache btrfs subvol=/@cache,defaults,noatime,space_cache,autodefrag,compress=zstd 0 2
UUID=8e50e065-11b1-4774-8082-1ab1ea33981e /var/log btrfs subvol=/@log,defaults,noatime,space_cache,autodefrag,compress=zstd 0 2
UUID=8e50e065-11b1-4774-8082-1ab1ea33981e /var/tmp btrfs subvol=/@tmp,defaults,noatime,space_cache,autodefrag,compress=zstd 0 2
/dev/disk/by-partlabel/Musik_Bilder_Videos /mnt/Musik_Bilder_Videos auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-partlabel/Backup_ssd /mnt/Backup_ssd auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-label/Dropbox /mnt/Dropbox auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-partlabel/SteamFast /mnt/SteamFast auto nosuid,nodev,nofail,x-gvfs-show 0 0

Binderfs Anbox

none /dev/binderfs binder nofail 0 0

makepkg

#!/hint/bash

/etc/makepkg.conf

#########################################################################

SOURCE ACQUISITION

#########################################################################

#-- The download utilities that makepkg should use to acquire sources

Format: 'protocol::agent'

DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
'ftp::/usr/bin/curl -qgfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
'http::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'https::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
'rsync::/usr/bin/rsync --no-motd -z %u %o'
'scp::/usr/bin/scp -C %u %o')

Other common tools:

/usr/bin/snarf

/usr/bin/lftpget -c

/usr/bin/wget

#-- The package required by makepkg to download VCS sources

Format: 'protocol::package'

VCSCLIENTS=('bzr::bzr'
'fossil::fossil'
'git::git'
'hg::mercurial'
'svn::subversion')

#########################################################################

ARCHITECTURE, COMPILE FLAGS

#########################################################################

CARCH="x86_64"
CHOST="x86_64-pc-linux-gnu"

#-- Compiler and Linker Flags
#CPPFLAGS=""
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
-Wp,-D_FORTIFY_SOURCE=2,-D_GLIBCXX_ASSERTIONS
-Wformat -Werror=format-security
-fstack-clash-protection -fcf-protection"
CXXFLAGS="$CFLAGS"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
#RUSTFLAGS="-C opt-level=2"
#-- Make Flags: change this for DistCC/SMP systems
MAKEFLAGS="-j$(nproc)"
#-- Debugging flags
DEBUG_CFLAGS="-g -fvar-tracking-assignments"
DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
#DEBUG_RUSTFLAGS="-C debuginfo=2"

#########################################################################

BUILD ENVIRONMENT

#########################################################################

Makepkg defaults: BUILDENV=(!distcc !color !ccache check !sign)

A negated environment option will do the opposite of the comments below.

#-- distcc: Use the Distributed C/C++/ObjC compiler
#-- color: Colorize output messages
#-- ccache: Use ccache to cache compilation
#-- check: Run the check() function if present in the PKGBUILD
#-- sign: Generate PGP signature file

BUILDENV=(!distcc color !ccache check !sign)

#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
#-- specify a space-delimited list of hosts running in the DistCC cluster.
#DISTCC_HOSTS=""

#-- Specify a directory for package building.
BUILDDIR=/tmp/makepkg

#########################################################################

GLOBAL PACKAGE OPTIONS

These are default values for the options=() settings

#########################################################################

Makepkg defaults: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug !lto)

A negated option will do the opposite of the comments below.

#-- strip: Strip symbols from binaries/libraries
#-- docs: Save doc directories specified by DOC_DIRS
#-- libtool: Leave libtool (.la) files in packages
#-- staticlibs: Leave static library (.a) files in packages
#-- emptydirs: Leave empty directories in packages
#-- zipman: Compress manual (man and info) pages in MAN_DIRS with gzip
#-- purge: Remove files specified by PURGE_TARGETS
#-- debug: Add debugging flags as specified in DEBUG_* variables
#-- lto: Add compile flags for building with link time optimization

OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !debug !lto)

#-- File integrity checks to use. Valid: md5, sha1, sha224, sha256, sha384, sha512, b2
INTEGRITY_CHECK=(sha256)
#-- Options to be used when stripping binaries. See man strip' for details. STRIP_BINARIES="--strip-all" #-- Options to be used when stripping shared libraries. See man strip' for details.
STRIP_SHARED="--strip-unneeded"
#-- Options to be used when stripping static libraries. See `man strip' for details.
STRIP_STATIC="--strip-debug"
#-- Manual (man and info) directories to compress (if zipman is specified)
MAN_DIRS=({usr{,/local}{,/share},opt/}/{man,info})
#-- Doc directories to remove (if !docs is specified)
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/
/{doc,gtk-doc})
#-- Files to be removed from all packages (if purge is specified)
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#-- Directory to store source code in for debug packages
DBGSRCDIR="/usr/src/debug"

#########################################################################

PACKAGE OUTPUT

#########################################################################

Default: put built package and cached source in build directory

#-- Destination: specify a fixed directory where all packages will be placed
#PKGDEST=/home/packages
#-- Source cache: specify a fixed directory where source files will be cached
#SRCDEST=/home/sources
#-- Source packages: specify a fixed directory where all src packages will be placed
#SRCPKGDEST=/home/srcpackages
#-- Log files: specify a fixed directory where all log files will be placed
#LOGDEST=/home/makepkglogs
#-- Packager: name/email of the person or organization building packages
#PACKAGER="John Doe [email protected]"
#-- Specify a key to use for package signing
#GPGKEY=""

#########################################################################

COMPRESSION DEFAULTS

#########################################################################

COMPRESSGZ=(gzip -c -f -n)
COMPRESSBZ2=(bzip2 -c -f)
COMPRESSXZ=(xz -c -z -)
COMPRESSZST=(zstd -c -z -q -)
COMPRESSLRZ=(lrzip -q)
COMPRESSLZO=(lzop -q)
COMPRESSZ=(compress -c -f)
COMPRESSLZ4=(lz4 -q)
COMPRESSLZ=(lzip -c -f)

#########################################################################

EXTENSION DEFAULTS

#########################################################################

PKGEXT='.pkg.tar.zst'
SRCEXT='.src.tar.gz'

#########################################################################

OTHER

#########################################################################

#-- Command used to run pacman as root, instead of trying sudo and su
#PACMAN_AUTH=()

inxi -Faz
inxi -Faz
System:    Kernel: 5.14.14-1-cacule-rdb x86_64 bits: 64 compiler: gcc v: 11.1.0
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-cacule-rdb root=UUID=8e50e065-11b1-4774-8082-1ab1ea33981e rw
[email protected] splash rd.udev.log_priority=3 vt.global_cursor_default=0 systemd.unified_cgroup_hierarchy=1
loglevel=3 usbhid.poll=1
Desktop: KDE Plasma 5.23.1 tk: Qt 5.15.2 wm: kwin_x11 vt: 1 dm: SDDM Distro: Garuda Linux base: Arch Linux
Machine:   Type: Desktop System: ASUS product: N/A v: N/A serial: <filter>
Mobo: ASUSTeK model: ROG STRIX B550-F GAMING v: Rev X.0x serial: <filter> UEFI: American Megatrends v: 2423
date: 08/10/2021
Battery:   Device-1: hidpp_battery_0 model: Logitech Wireless Keyboard K270 serial: <filter> charge: 100% (should be ignored)
rechargeable: yes status: Discharging
CPU:       Info: 12-Core model: AMD Ryzen 9 3900X bits: 64 type: MT MCP arch: Zen 2 family: 17 (23) model-id: 71 (113)
stepping: 0 microcode: 8701021 cache: L2: 6 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 192078
Speed: 4000 MHz min/max: 550/4919 MHz boost: enabled Core speeds (MHz): 1: 4000 2: 4000 3: 3999 4: 3999 5: 4000
6: 4000 7: 3999 8: 3999 9: 4000 10: 3999 11: 4000 12: 4000 13: 4000 14: 3996 15: 3999 16: 4000 17: 3999 18: 4000
19: 4000 20: 4000 21: 4000 22: 4000 23: 4000 24: 3999
Vulnerabilities: Type: itlb_multihit status: Not affected
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, STIBP: conditional, RSB filling
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] vendor: ASUSTeK
driver: amdgpu v: kernel bus-ID: 0a:00.0 chip-ID: 1002:731f class-ID: 0300
Device-2: Logitech HD Webcam C510 type: USB driver: snd-usb-audio,uvcvideo bus-ID: 1-9:7 chip-ID: 046d:081d
class-ID: 0e02 serial: <filter>
Display: x11 server: X.Org 1.20.13 compositor: kwin_x11 driver: loaded: amdgpu display-ID: :0 screens: 1
Screen-1: 0 s-res: 3840x2160 s-dpi: 192 s-size: 508x285mm (20.0x11.2") s-diag: 582mm (22.9")
Monitor-1: DisplayPort-0 res: 3840x2160 hz: 60 dpi: 154 size: 632x360mm (24.9x14.2") diag: 727mm (28.6")
OpenGL: renderer: AMD Radeon RX 5700 XT (navi10 LLVM 12.0.1 DRM 3.42 5.14.14-1-cacule-rdb)
v: 4.6 Mesa 22.0.0-devel (git-d50be41f8f) direct render: Yes
Audio:     Device-1: Advanced Micro Devices [AMD/ATI] Navi 10 HDMI Audio driver: snd_hda_intel v: kernel bus-ID: 0a:00.1
chip-ID: 1002:ab38 class-ID: 0403
Device-2: Advanced Micro Devices [AMD] Starship/Matisse HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel
bus-ID: 0c:00.4 chip-ID: 1022:1487 class-ID: 0403
Device-3: Logitech HD Webcam C510 type: USB driver: snd-usb-audio,uvcvideo bus-ID: 1-9:7 chip-ID: 046d:081d
class-ID: 0e02 serial: <filter>
Sound Server-1: ALSA v: k5.14.14-1-cacule-rdb running: yes
Sound Server-2: sndio v: N/A running: no
Sound Server-3: JACK v: 1.9.19 running: no
Sound Server-4: PulseAudio v: 15.0 running: no
Sound Server-5: PipeWire v: 0.3.38 running: yes
Network:   Device-1: Intel Ethernet I225-V vendor: ASUSTeK driver: igc v: kernel port: N/A bus-ID: 07:00.0 chip-ID: 8086:15f3
class-ID: 0200
IF: enp7s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
IF-ID-1: anbox0 state: down mac: <filter>
IF-ID-2: wg-mullvad state: unknown speed: N/A duplex: N/A mac: N/A
Drives:    Local Storage: total: 6.15 TiB used: 2.83 TiB (46.0%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/nvme0n1 maj-min: 259:4 vendor: Corsair model: Corsair MP400 size: 1.82 TiB block-size: physical: 512 B
logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter> rev: ECFM53.0 temp: 44.9 C scheme: GPT
ID-2: /dev/nvme1n1 maj-min: 259:0 vendor: Samsung model: SSD 970 EVO Plus 1TB size: 931.51 GiB block-size:
physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter> rev: 2B2QEXM7 temp: 42.9 C
scheme: GPT
ID-3: /dev/sda maj-min: 8:0 vendor: Crucial model: CT1000MX500SSD1 size: 931.51 GiB block-size: physical: 512 B
logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter> rev: 020 scheme: GPT
ID-4: /dev/sdb maj-min: 8:16 vendor: Samsung model: SSD 860 QVO 2TB size: 1.82 TiB block-size: physical: 512 B
logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter> rev: 2B6Q scheme: GPT
ID-5: /dev/sdc maj-min: 8:32 vendor: Samsung model: SSD 850 EVO 500GB size: 465.76 GiB block-size: physical: 512 B
logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter> rev: 2B6Q scheme: GPT
ID-6: /dev/sdd maj-min: 8:48 type: USB vendor: Samsung model: Type-C size: 239.02 GiB block-size: physical: 512 B
logical: 512 B type: N/A serial: <filter> rev: 1100 scheme: GPT
SMART Message: Unknown USB bridge. Flash drive/Unsupported enclosure?
Partition: ID-1: / raw-size: 930.94 GiB size: 930.94 GiB (100.00%) used: 689.23 GiB (74.0%) fs: btrfs dev: /dev/nvme0n1p2
maj-min: 259:6
ID-2: /boot/efi raw-size: 599 MiB size: 597.8 MiB (99.80%) used: 259.9 MiB (43.5%) fs: vfat dev: /dev/nvme0n1p1
maj-min: 259:5
ID-3: /home raw-size: 930.94 GiB size: 930.94 GiB (100.00%) used: 689.23 GiB (74.0%) fs: btrfs dev: /dev/nvme0n1p2
maj-min: 259:6
ID-4: /var/log raw-size: 930.94 GiB size: 930.94 GiB (100.00%) used: 689.23 GiB (74.0%) fs: btrfs
dev: /dev/nvme0n1p2 maj-min: 259:6
ID-5: /var/tmp raw-size: 930.94 GiB size: 930.94 GiB (100.00%) used: 689.23 GiB (74.0%) fs: btrfs
dev: /dev/nvme0n1p2 maj-min: 259:6
Swap:      Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 62.72 GiB used: 0 KiB (0.0%) priority: 100 dev: /dev/zram0
Sensors:   System Temperatures: cpu: 54.6 C mobo: 33.0 C gpu: amdgpu temp: 57.0 C mem: 52.0 C
Fan Speeds (RPM): fan-1: 845 fan-2: 1503 fan-3: 778 fan-4: 787 fan-5: 0 fan-6: 0 fan-7: 0 gpu: amdgpu fan: 0
Info:      Processes: 543 Uptime: 1h 21m wakeups: 16 Memory: 62.72 GiB used: 16.66 GiB (26.6%) Init: systemd v: 249
tool: systemctl Compilers: gcc: 11.1.0 clang: 12.0.1 Packages: pacman: 2281 lib: 584 Shell: fish v: 3.3.1
running-in: konsole inxi: 3.3.07 

Makepkg#Improving_compile_times
Tmpfs

Hi there, @smoky

No, you don't have to edit fstab. As mentioned in Archwiki,

By default, a tmpfs partition has its maximum size set to half of the available RAM

But if, for some reasons, you have to change its size or use other options, you can edit your fstab file.

3 Likes

Thanks for the info

2 Likes
#!/bin/bash
echo "echo mounting bigger tmpfs for compiling"
sudo mount -o remount,size=25G,noatime /tmp
echo "Done. Please use 'df -h' to make sure folder size is increased."

Here is a script which i use most time

3 Likes

Thx i will try it

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.