fsck filesystem before mount

Use fsck -p to fix errors that are fixable.

Note this will recreate the filesystem on fatal errors.

Fix #665

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2016-11-01 16:01:08 +00:00
parent 0f357d2ed5
commit 72d1aef471

View File

@ -45,7 +45,7 @@ start()
ERASE_DISKS="${DRIVE}" setup-disk -m data ${DRIVE}
blockdev --rereadpt "${DRIVE}" 2> /dev/null
else
( mount "${DATA}" /var && ([ -z "${SWAP}" ] || swapon "${SWAP}") ) || \
( e2fsck -p "${DATA}" && mount "${DATA}" /var && ([ -z "${SWAP}" ] || swapon "${SWAP}") ) || \
( ERASE_DISKS="${DRIVE}" setup-disk -m data ${DRIVE}; blockdev --rereadpt ${DRIVE} 2> /dev/null )
fi
# boot2docker compat, has /var and /tmp on partition