Skip to content

Commit

Permalink
[installer]: limit size of /var/log (#284)
Browse files Browse the repository at this point in the history
Create loop device during installation of
size soecified in config file for machine

Signed-off-by: marian-pritsak <[email protected]>
  • Loading branch information
marian-pritsak authored and lguohan committed Feb 17, 2017
1 parent a962c0b commit f9f31ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions files/initramfs-tools/union-mount.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ mount --bind ${rootmnt}/host/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker
## Mount the boot directory in the raw partition, bypass the aufs
mkdir -p ${rootmnt}/boot
mount --bind ${rootmnt}/host/boot ${rootmnt}/boot
## Mount loop device for /var/log
[ -f ${rootmnt}/host/disk-img/var-log.ext4 ] && mount -t ext4 -o loop,rw ${rootmnt}/host/disk-img/var-log.ext4 ${rootmnt}/var/log
11 changes: 11 additions & 0 deletions installer/x86_64/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ CONSOLE_SPEED=9600

# Get platform specific linux kernel command line arguments
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX=""

# Default var/log device size in MB
VAR_LOG_SIZE=4096

[ -r platforms/$onie_platform ] && source platforms/$onie_platform

# Install demo on same block device as ONIE
Expand Down Expand Up @@ -401,6 +405,13 @@ if [ -f $demo_mnt/$FILESYSTEM_DOCKERFS ]; then
cd $demo_mnt && mkdir -p $DOCKERFS_DIR && tar xf $FILESYSTEM_DOCKERFS -C $DOCKERFS_DIR; cd $OLDPWD
fi
# Create loop device for /var/log to limit its size to $VAR_LOG_SIZE MB
if [ "$VAR_LOG_SIZE" != "0" ]; then
mkdir -p $demo_mnt/disk-img
dd if=/dev/zero of=$demo_mnt/disk-img/var-log.ext4 count=$((2048*$VAR_LOG_SIZE))
mkfs.ext4 -q $demo_mnt/disk-img/var-log.ext4 -F
fi
# Store machine description in target file system
cp /etc/machine.conf $demo_mnt
Expand Down

0 comments on commit f9f31ed

Please sign in to comment.