update resize2fs-arch.sh 2.0

This commit is contained in:
soundcheck 2014-02-15 15:09:33 +01:00
parent 3d0c55c1a7
commit 9cb03e30a3

View file

@ -11,40 +11,34 @@
# #
##################################################################################### #####################################################################################
REVISION=1.0 REVISION=2.0
DATE=02132014 DATE=02152014
DISKID=mmcblk0 DISCID=mmcblk0
PARTID=mmcblk0p1 PARTID=mmcblk0p1
test -b /dev/$DISCID || { echo "SD device /dev/$DISCID can not be identifed. Please verify." ; exit 1 ; } ;
resizepartition() { resizepartition() {
echo "******Resizing partition******************************" echo "******Resizing partition******************************"
echo echo
sync sync
##### fdisk commands FIRSTSECTOR="$(( echo p) | fdisk "/dev/$DISCID" | grep $PARTID | sed "s/\*//g" | tr -s " " | cut -f 2 -d " " )"
#p print (check if first sector @2048 !! very important, if not all data ar elost if you continue !!!) #echo $FIRSTSECTOR
#d delete partition (just the table!) ( echo d; echo n; echo p; echo 1; echo $FIRSTSECTOR; echo; echo w; ) | fdisk /dev/$DISCID
#n new partition
#p primary partition
#1 partition number
#<ret> confirm default first sector @ 2048
#<ret> confirm default last sector @ max
#p print to verify new setup
#w write to disk
#####
FIRSTSECTOR="$(( echo p) | fdisk /dev/$DISKID | grep $PARTID | sed "s/\*//g" | tr -s " " | cut -f 2 -d " " )"
( echo d; echo n; echo p; echo 1; echo $FIRSTSECTOR; echo; echo w; ) | fdisk /dev/$DISKID
shutdown -r now shutdown -r now
} }
resizefs() { resizefs() {
echo "******Resizing filesystem******************************" echo "******Resizing filesystem******************************"
echo echo
resize2fs -p /dev/$PARTID resize2fs -p /dev/$PARTID
} }
@ -52,9 +46,8 @@ resize2fs -p /dev/$PARTID
help() { help() {
echo " echo "
############################################### ###############################################
Resizing Tool for Partion and Filesystem FS partitioning and resizing tool
Applicable to ArchLinux on Cubietruck. for SD card
Revision $REVISION Revision $REVISION
Warning: Warning:
@ -75,9 +68,9 @@ Options:
case $1 in case $1 in
p) resizepartition -p) resizepartition
;; ;;
f) resizefs -f) resizefs
;; ;;
*) help *) help
;; ;;