马哥下午课程精简

  #!/bin/bash

  2 #Version:0.0.1
  3 #Author :QinQin Zhou
  4 #Datetime:2012-6-4
  5 #Description:
  6 echo "  
  7 n
  8 
  9 +10G
 10 t
 11 5
 12 8e
 13 n
 14 
 15 +5G
 16 t
 17 6
 18 8e
 19 w" | fdisk /dev/sda
 20 partprobe /dev/sda
 21 pvcreate /dev/sda5
 22 pvdisplay
 23 vgcreate myvg /dev/sda5
 24 vgdisplay myvg
 25 lvcreate -L 2G -n mylv1 myvg
 26 lvdisplay /dev/myvg/mylv1
 27 mke2fs -j /dev/myvg/mylv1
 28 echo '/dev/mylv1                /backup                 ext3    defaults        0 0' >> /etc/fstab
 29 mkdir /backup
 30 mount -a
 31 cd /backup
 32 cp /etc/fstab ./
 33 ls /backup
 34 pvcreate /dev/sda6
 35 vgextend myvg /dev/sda6
 36 pvmove /dev/sda5 /dev/sda6
 37 vgreduce myvg /dev/sda5
 38 vgs
 39 ls /backup
 40 cat /backup/fstab
 41 pvremove /dev/sda5
 42 pvs
 43 lvextend -L 3G /dev/myvg/mylv1
 44 df -lh
 45 resize2fs /dev/myvg/mylv1
 46 df -lh
 47 cat /backup/fstab
 48 unmount /backup
 49 e2fsck -f /dev/myvg/mylv1
 50 resize2fs /dev/myvg/mylv1 1G
 51 lvextend -L 1G /dev/myvg/mylv1
 52 e2fsck -f /dev/myvg/mylv1
 53 mount /dev/myvg/mylv1
 54 cat /backup/fstab
 55 lvcreate -L 50M -n mylv1-snap -a -p r /dev/myvg/mylv1
 56 ls -l /dev/myvg
 57 mkdir /snap
 58 mount -o ro /dev/myvg/mylv1-snap /snap
 59 cd /snap
 60 ls
 61 echo "new line." >> /backup/fstab
 62 cat /backup/fstab
 63 cat /snap/fstab
 64 tar -jcf /root/backup.tar.bz2 /snap/*
 65 cd
 66 umount /snap
 67 lvremove -f /dev/myvg/mylv1-snap
 68 lvs
 

你可能感兴趣的:(课程,马,哥)