Statistics
| Branch: | Tag: | Revision:

root / snf-image-helper / tasks / 20FilesystemResizeUnmounted.in @ c334f836

History | View | Annotate | Download (1.4 kB)

1 0a35a4ab Nikos Skalkotos
#! /bin/bash
2 c349d1b3 Nikos Skalkotos
3 7e5d635b Nikos Skalkotos
# Copyright (C) 2011 GRNET S.A. 
4 7e5d635b Nikos Skalkotos
#
5 7e5d635b Nikos Skalkotos
# This program is free software; you can redistribute it and/or modify
6 7e5d635b Nikos Skalkotos
# it under the terms of the GNU General Public License as published by
7 7e5d635b Nikos Skalkotos
# the Free Software Foundation; either version 2 of the License, or
8 7e5d635b Nikos Skalkotos
# (at your option) any later version.
9 7e5d635b Nikos Skalkotos
#
10 7e5d635b Nikos Skalkotos
# This program is distributed in the hope that it will be useful, but
11 7e5d635b Nikos Skalkotos
# WITHOUT ANY WARRANTY; without even the implied warranty of
12 7e5d635b Nikos Skalkotos
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 7e5d635b Nikos Skalkotos
# General Public License for more details.
14 7e5d635b Nikos Skalkotos
#
15 7e5d635b Nikos Skalkotos
# You should have received a copy of the GNU General Public License
16 7e5d635b Nikos Skalkotos
# along with this program; if not, write to the Free Software
17 7e5d635b Nikos Skalkotos
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 7e5d635b Nikos Skalkotos
# 02110-1301, USA.
19 7e5d635b Nikos Skalkotos
20 c349d1b3 Nikos Skalkotos
### BEGIN TASK INFO
21 42f09a19 Nikos Skalkotos
# Provides:		FilesystemResizeUnmounted
22 c349d1b3 Nikos Skalkotos
# RunBefore:		MountImage
23 42f09a19 Nikos Skalkotos
# RunAfter:             FixPartitionTable
24 c349d1b3 Nikos Skalkotos
# Short-Description:	Resize filesystem to use all the available space
25 6a95db10 Vangelis Koukis
### END TASK INFO
26 c349d1b3 Nikos Skalkotos
27 c349d1b3 Nikos Skalkotos
set -e
28 bad5ca1f Nikos Skalkotos
. "@commondir@/common.sh"
29 c349d1b3 Nikos Skalkotos
30 aaa0b3fd Nikos Skalkotos
if [ ! -b "$SNF_IMAGE_DEV" ]; then
31 8704ee47 Nikos Skalkotos
    log_error "Device file:\`${SNF_IMAGE_DEV}' is not a block device"
32 c349d1b3 Nikos Skalkotos
fi
33 42f09a19 Nikos Skalkotos
34 42f09a19 Nikos Skalkotos
last_partition=$(get_last_partition "$SNF_IMAGE_DEV")
35 42f09a19 Nikos Skalkotos
id=$(echo "$last_partition" | cut -d: -f1)
36 42f09a19 Nikos Skalkotos
ptype=$(echo "$last_partition" | cut -d: -f5)
37 42f09a19 Nikos Skalkotos
38 f6e23601 Nikos Skalkotos
if [[ "$ptype" == ext[234] ]]; then
39 f6e23601 Nikos Skalkotos
    device="${SNF_IMAGE_DEV}${id}"
40 de0cc3e9 Nikos Skalkotos
    $E2FSCK -f "$devide"
41 de0cc3e9 Nikos Skalkotos
    $RESIZE2FS "$device"
42 42f09a19 Nikos Skalkotos
fi
43 c349d1b3 Nikos Skalkotos
44 c349d1b3 Nikos Skalkotos
exit 0
45 5d3735b5 Nikos Skalkotos
46 c349d1b3 Nikos Skalkotos
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :