File: //usr/syno/lib/systemd/scripts/space.sh
#!/bin/sh
# Copyright (c) 2000-2018 Synology Inc. All rights reserved.
SpaceStart()
{
#adjust default sync speed to 10 MB/s as minimum, 600MB/s as maximum
/sbin/sysctl -w dev.raid.speed_limit_min=1
/sbin/sysctl -w dev.raid.speed_limit_max=2
if [ -x /usr/syno/bin/spacetool.shared ]; then
/usr/syno/sbin/synostoragecore --resource-cleanup
/usr/syno/bin/spacetool.shared --bootup-repair-shr-part-num
/usr/syno/bin/spacetool.shared --bootup-assemble
/usr/syno/bin/spacetool.shared --fast-repair-cleanup
fi
}
SpaceStop()
{
/usr/syno/sbin/synostgpool --missing --update
if [ -x /usr/syno/bin/spacetool.shared ]; then
/usr/syno/bin/spacetool.shared --disassemble-all
fi
}
VSpaceStart()
{
/usr/syno/bin/synovspace -stage-load until ha
}
VSpaceStop()
{
/usr/syno/bin/synovspace -all-unload
}
VSpaceStartPhase2()
{
/usr/syno/bin/synovspace -stage-load after ha
}
VSpaceStopPhase2()
{
/usr/syno/bin/synovspace -stage-unload before ha
}
SpaceTableStart()
{
/usr/syno/sbin/synostgpool --missing-space --update --skip-boot-done-check
/usr/syno/sbin/synostgpool --missing-space --clean-faulty-disks
/usr/syno/sbin/synostgpool --missing-space --set-normal-disk-normal
}
case "$1" in
--space-start)
SpaceStart
;;
--space-stop)
SpaceStop
;;
--vspace-start)
VSpaceStart
;;
--vspace-stop)
VSpaceStop
;;
--vspace-start-phase2)
VSpaceStartPhase2
;;
--vspace-stop-phase2)
VSpaceStopPhase2
;;
--space-table-start)
SpaceTableStart
;;
*)
;;
esac
exit 0