Xu Xiaodong avatar Xu Xiaodong committed bd8b4ef

big update

Comments (0)

Files changed (17)

 用途:
 =====
 
-  利用 ucloner 备份/还原 ubuntu 系统.
+  利用 ucloner 备份/克隆/还原 ubuntu 系统.
 
 用法:
 =====
 
   * run_bak.sh 备份
+  * run_cln.sh 克隆
   * run_reshdd.sh 针对传统硬盘还原
-  * run_resssd.sh 针对固态硬盘还原
+  * run_resssd.sh 针对 30G 固态硬盘还原
+  * run_resssd16.sh 针对 16G 固态硬盘还原
   * run_resufd.sh 针对优盘进行还原
+#!/bin/sh
+#
+# description:  删除 /dev/sda (硬盘) 的所有分区
+# author:       Xu Xiaodong <xxdlhy@gmail.com>
+# modified:     2011 Aug 14
+#
+
+CMD=fdisk
+DEVICE=/dev/sda
+
+sudo "$CMD" "$DEVICE" <<'EOF'
+d
+1
+d
+2
+d
+3
+d
+
+w
+EOF
+
+if [ "$?" -eq 0 ]; then
+  echo "已删除 $DEVICE 的所有分区."
+else
+  echo "$DEVICE 的分区删除失败."
+fi
+
+sleep 5m
+
+# vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=sh
+del_hdd_part.sh
+#!/bin/sh
+#
+# description:  删除 /dev/sdc (优盘) 的所有分区
+# author:       Xu Xiaodong <xxdlhy@gmail.com>
+# modified:     2011 Aug 14
+#
+
+CMD=fdisk
+DEVICE=/dev/sdc
+
+sudo "$CMD" "$DEVICE" <<'EOF'
+d
+
+w
+EOF
+
+if [ "$?" -eq 0 ]; then
+  echo "已删除 $DEVICE 的所有分区."
+else
+  echo "$DEVICE 的分区删除失败."
+fi
+
+sleep 5m
+
+# vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=sh

part_del.sh

-#!/bin/sh
-#
-# description:  删除 /dev/sda 的所有分区
-# author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Jul 25
-#
-
-CMD=fdisk
-DEVICE=/dev/sda
-
-sudo $CMD $DEVICE <<'EOF'
-d
-1
-d
-2
-d
-3
-d
-4
-w
-EOF
-
-if [ $? -eq 0 ]; then
-  echo
-  echo "已删除 /dev/sda 的所有分区."
-fi
-
-sleep 5m
-
-# vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=sh

part_delufd.sh

-#!/bin/sh
-#
-# description:  删除 /dev/sdb 的所有分区
-# author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Aug 12
-#
-
-CMD=fdisk
-DEVICE=/dev/sdb
-
-sudo $CMD $DEVICE <<'EOF'
-d
-1
-w
-EOF
-
-if [ $? -eq 0 ]; then
-  echo
-  echo "已删除 /dev/sdb 的所有分区."
-fi
-
-sleep 5m
-
-# vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=sh
 # description:  针对 320G 硬盘进行自动分区
 #               / 10G, /tmp 5G, /var 25G, /home 278, swap 2G
 # author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Jul 25
+# modified:     2011 Aug 14
 #
 
 CMD=fdisk
 DEVICE=/dev/sda
 
-sudo $CMD $DEVICE <<'EOF'
+sudo "$CMD" "$DEVICE" <<'EOF'
 n
 p
 1
 # description:  针对 30G 固态硬盘进行自动分区
 #               / 6G, /tmp 1G, /var 3G, /home 18G, swap 2G
 # author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Jul 26
+# modified:     2011 Aug 14
 #
 
 CMD=fdisk
 DEVICE=/dev/sda
 
-sudo $CMD $DEVICE <<'EOF'
+sudo "$CMD" "$DEVICE" <<'EOF'
 n
 p
 1
 # description:  针对 16G 固态硬盘进行自动分区
 #               / 6G, /tmp 1G, /var 2G, /home 6G, swap 1G
 # author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Aug 12
+# modified:     2011 Aug 14
 #
 
 CMD=fdisk
 DEVICE=/dev/sda
 
-sudo $CMD $DEVICE <<'EOF'
+sudo "$CMD" "$DEVICE" <<'EOF'
 n
 p
 1
 #
 # description:  针对 8G 优盘进行自动分区
 # author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Aug 12
+# modified:     2011 Aug 14
 #
 
 CMD=fdisk
-DEVICE=/dev/sdb
+DEVICE=/dev/sdc
 
-sudo $CMD $DEVICE <<'EOF'
+sudo "$CMD" "$DEVICE" <<'EOF'
 n
 p
 1
       exclude=/home/ubox/ucloner
     ;;
   udisk)
+    "$SH"/part_ufd.sh > /dev/null 2>&1
     sudo ./ucloner_cmd.py mode=restore restore_from="$IMAGE" \
       /=/dev/sdc1 /_fs=ext4 \
       grubdev=/dev/sdc
 #
 # description:  利用 ucloner 备份 ubox 系统
 # author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Jul 24
+# modified:     2011 Aug 14
 #
 
-PROG=$HOME/resbox
+PROG="$HOME"/tools/resbox
 
-cd $PROG
-./resbox backup
-sleep 30m
+if [ -d "$PORG" ]; then
+  cd "$PROG"
+  ./resbox backup
+else
+  echo "目录 $PROG 不存在."
+  exit 1
+fi
+
+sleep 5m
 
 # vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=sh
 #
 # description:  利用 ucloner 克隆 ubox 系统
 # author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Jul 29
+# modified:     2011 Aug 14
 #
 
-PROG=$HOME/resbox
+PROG="$HOME"/tools/resbox
 
-cd $PROG
-./resbox clone
-sleep 30m
+if [ -d "$PORG" ]; then
+  cd "$PROG"
+  ./resbox clone
+else
+  echo "目录 $PROG 不存在."
+  exit 1
+fi
+
+sleep 5m
 
 # vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=sh
 #
 # description:  利用 ucloner 还原 ubox 系统 (传统硬盘)
 # author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Jul 24
+# modified:     2011 Aug 14
 #
 
-PROG=$HOME/resbox
+PROG="$HOME"/tools/resbox
 
-cd $PROG
-./resbox restore hdd
-sleep 30m
+if [ -d "$PORG" ]; then
+  cd "$PROG"
+  ./resbox restore hdd
+else
+  echo "目录 $PROG 不存在."
+  exit 1
+fi
+
+sleep 5m
 
 # vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=sh
 #!/bin/sh
 #
-# description:  利用 ucloner 还原 ubox 系统 (固态硬盘)
+# description:  利用 ucloner 还原 ubox 系统 (30G 固态硬盘)
 # author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Jul 24
+# modified:     2011 Aug 14
 #
 
-PROG=$HOME/resbox
+PROG="$HOME"/tools/resbox
 
-cd $PROG
-./resbox restore ssd
-sleep 30m
+if [ -d "$PROG" ]; then
+  cd "$PROG"
+  ./resbox restore ssd
+else
+  echo "目录 $PROG 不存在."
+  exit 1
+fi
+
+sleep 5m
 
 # vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=sh
 #!/bin/sh
 #
-# description:  利用 ucloner 还原 ubox 系统 (16 G固态硬盘)
+# description:  利用 ucloner 还原 ubox 系统 (16G 固态硬盘)
 # author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Aug 12
+# modified:     2011 Aug 14
 #
 
-PROG=$HOME/resbox
+PROG="$HOME"/tools/resbox
 
-cd $PROG
-./resbox restore ssd16
-sleep 30m
+if [ -d "$PORG" ]; then
+  cd "$PROG"
+  ./resbox restore ssd16
+else
+  echo "目录 $PROG 不存在."
+  exit 1
+fi
+
+sleep 5m
 
 # vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=sh
 #
 # description:  利用 ucloner 还原 ubox 系统 (优盘)
 # author:       Xu Xiaodong <xxdlhy@gmail.com>
-# modified:     2011 Jul 24
+# modified:     2011 Aug 14
 #
 
-PROG=$HOME/resbox
+PROG="$HOME"/tools/resbox
 
-cd $PROG
-./resbox udisk
-sleep 30m
+if [ -d "$PORG" ]; then
+  cd "$PROG"
+  ./resbox udisk
+else
+  echo "目录 $PROG 不存在."
+  exit 1
+fi
+
+sleep 5m
 
 # vim: ai:et:ts=2:sw=2:sts=2:tw=78:ft=sh
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.