]>
git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blob - src/initscripts/system/partresize
2 ########################################################################
3 # Begin $rc_base/init.d/partresize
5 # Description : Resize the root partition to the drivesize
7 # Authors : Arne Fitzenreiter - arne_f@ipfire.org
13 ########################################################################
20 if [ -e "/.partresize" ]; then
22 boot_mesg
"Mounting root file system in read/write mode ..."
23 mount
-o remount
,rw
/ > /dev
/null
26 boot_mesg
"Create /etc/mtab..."
28 mount
-f / || failed
=1
32 mount
/boot
> /dev
/null
33 if [ -e /boot
/grub
/grub.cfg
]; then
34 # swtich permanent to serial console if it was selected on first boot
35 if [ ! "$(grep "console
=ttyS0
" /proc/cmdline)" == "" ]; then
36 # Enable also serial console on GRUB
37 echo "GRUB_TERMINAL=\"serial console\"" >> /etc
/default
/grub
38 echo "GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=115200\"" >> /etc
/default
/grub
39 sed -i -e "s|panic=10|& console=ttyS0,115200n8|g" /etc
/default
/grub
42 # Re-generate GRUB configuration
43 /usr
/sbin
/grub-mkconfig
-o /boot
/grub
/grub.cfg
45 umount
/boot
> /dev
/null
48 mount |
while read -r dev tmp1 mountpoint tmp2
; do
49 [ "${dev}" = "rootfs" ] && continue
51 if [ "${mountpoint}" = "/" ]; then
52 # Find root partition number
55 # Find path to the root device
57 if [ ! -b "${dev::-1}" -a "${root_dev: -1}" = "p" ]; then
61 boot_mesg
"Growing root partition to maximum size..."
62 echo -e ',+' | sfdisk
--no-reread -f -N${part_num} "${root_dev}" 2>/dev
/null
64 # Update c,h,s values of the boot partition...
65 if [ ${part_num} -ne 1 -a -b "${root_dev}1" ]; then
66 echo -e ',' | sfdisk
--no-reread -f -N1 ${DRV} &> /dev
/null
69 # The filesystem should be resized after
77 boot_mesg
"Rebooting system..."
78 mount
-o remount
,ro
/ &>/dev
/null
86 echo "Usage: ${0} {start}"
91 # End $rc_base/init.d/partresize