[installer]: limit size of /var/log (#284)

Create loop device during installation of
size soecified in config file for machine

Signed-off-by: marian-pritsak <marianp@mellanox.com>
This commit is contained in:
Marian Pritsak 2017-02-17 09:28:09 +02:00 committed by lguohan
parent a962c0b386
commit f9f31ed296
2 changed files with 13 additions and 0 deletions

View File

@ -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

View File

@ -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
@ -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