Журнал лабораторных работ

Содержание

Журнал

Пятница (02/24/12)

/dev/pts/3
11:44:57
#vi /etc/network/interfaces
--- /tmp/l3-saved-2751.2075.18297	2012-02-24 12:45:34.000000000 +0200
+++ /etc/network/interfaces	2012-02-24 12:45:55.000000000 +0200
@@ -29,5 +29,5 @@
 iface eth0.40 inet manual
         up brctl addbr br40
         up brctl addif br40 eth0.40
-        up ifconfig br10 192.168.40.4 255.255.255.0
+        up ifconfig br40 192.168.40.4 255.255.255.0
 
/dev/pts/5
11:45:00
#cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo eth0.10 eth0.40
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address 10.0.35.44
        netmask 255.255.255.0
...
iface eth0.10 inet static
        address 192.168.10.4
        netmask 255.255.255.0
#iface eth0.40 inet static
#       address 192.168.40.4
#       netmask 255.255.255.0
iface eth0.40 inet manual
        up brctl addbr br40
        up brctl addif br40 eth0.40
        up ifconfig br10 192.168.40.4 255.255.255.0
11:45:04
#brctl show
bridge name     bridge id               STP enabled     interfaces
br40            8000.000ffe7ea77b       no              eth0.40
                                                        vif1.0
/dev/pts/1
11:45:55
#vi clonevm
/dev/pts/3
11:45:55
#vi clonevm
--- /dev/null	2012-02-24 12:41:55.008000001 +0200
+++ clonevm	2012-02-24 12:49:42.000000000 +0200
@@ -0,0 +1,19 @@
+
+NAME="$1"
+SOURCE=/dev/VG0/vol1
+DEST=/dev/VG0/${NAME}
+set -e
+lvcreate -L 4G -n ${NAME} /dev/VG0
+mkfs.ext3 ${DEST}
+mkdir -p /mnt2/
+mount ${SOURCE} /mnt/
+mount ${DEST} /mnt2/
+rsync -a /mnt/ /mnt2/
+cat <<EOF
+   edit /mnt/etc/network/interfaces and /etc/hostname
+   and then exit
+EOF
+bash
+umount /mnt
+umount /mnt2
+
/dev/pts/1
11:49:42
#cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo eth0.10 eth0.40
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address 10.0.35.44
        netmask 255.255.255.0
...
iface eth0.10 inet static
        address 192.168.10.4
        netmask 255.255.255.0
#iface eth0.40 inet static
#       address 192.168.40.4
#       netmask 255.255.255.0
iface eth0.40 inet manual
        up brctl addbr br40
        up brctl addif br40 eth0.40
        up ifconfig br40 192.168.40.4 255.255.255.0
/dev/pts/3
11:49:42
#cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo eth0.10 eth0.40
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address 10.0.35.44
        netmask 255.255.255.0
...
iface eth0.10 inet static
        address 192.168.10.4
        netmask 255.255.255.0
#iface eth0.40 inet static
#       address 192.168.40.4
#       netmask 255.255.255.0
iface eth0.40 inet manual
        up brctl addbr br40
        up brctl addif br40 eth0.40
        up ifconfig br40 192.168.40.4 255.255.255.0
/dev/pts/1
11:52:44
#chmod +x clonevm

/dev/pts/3
11:52:44
#chmod +x clonevm

/dev/pts/1
11:52:54
#./clonevm
./clonevm: line 1: f: команда не найдена
./clonevm: line 2: syntax error near unexpected token `then'
./clonevm: line 2: `then'
/dev/pts/3
11:52:54
#./clonevm
./clonevm: line 1: f: команда не найдена
./clonevm: line 2: syntax error near unexpected token `then'
./clonevm: line 2: `then'
/dev/pts/1
11:53:00
#vi clonevm
/dev/pts/3
11:53:00
#vi clonevm
--- /tmp/l3-saved-2751.14507.25779	2012-02-24 12:53:13.000000000 +0200
+++ clonevm	2012-02-24 12:53:46.000000000 +0200
@@ -1,4 +1,4 @@
-f [ $# != 2 ]
+if [ $# != 2 ]
 then
     cat <<EOF
 Usage:
/dev/pts/1
11:53:46
#./clonevm
Usage:
 ./clonevm source-volume dest-volume
Example:
 ./clonevm vol2
EOF
    exit 1
fi
if [ "" = "" ]
then
    cat <<EOF
Source and destination volumes are the same:
/dev/pts/3
11:53:46
#./clonevm
Usage:
 ./clonevm source-volume dest-volume
Example:
 ./clonevm vol2
EOF
    exit 1
fi
if [ "" = "" ]
then
    cat <<EOF
Source and destination volumes are the same:
/dev/pts/1
11:53:50
#man scp
/dev/pts/3
11:53:50
#man scp
/dev/pts/1
11:56:15
#scp debian5:/root/clone-vm clonevm
clone-vm                                                                                                                                                                                                                                             100%  568     0.6KB/s   00:00
/dev/pts/3
11:56:15
#scp debian5:/root/clone-vm clonevm
clone-vm                                                                                                                                                                                                                                             100%  568     0.6KB/s   00:00
/dev/pts/1
11:56:26
#ls clonevm
clonevm
/dev/pts/3
11:56:26
#ls clonevm
clonevm
/dev/pts/1
11:56:37
#ls -la clonevm
-rwxr-xr-x 1 root root 568 Фев 24 12:56 clonevm
/dev/pts/3
11:56:37
#ls -la clonevm
-rwxr-xr-x 1 root root 568 Фев 24 12:56 clonevm
/dev/pts/1
11:56:43
#cat clonevm
if [ $# != 2 ]
then
    cat <<EOF
Usage:
 $0 source-volume dest-volume
Example:
 $0 vol1 vol2
EOF
    exit 1
fi
...
mount ${SOURCE} /mnt/
mount ${DEST} /mnt2/
rsync -a /mnt/ /mnt2/
cat <<EOF
   edit /mnt/etc/network/interfaces and /etc/hostname
   and then exit
EOF
bash
umount /mnt
umount /mnt2
/dev/pts/3
11:56:43
#cat clonevm
if [ $# != 2 ]
then
    cat <<EOF
Usage:
 $0 source-volume dest-volume
Example:
 $0 vol1 vol2
EOF
    exit 1
fi
...
mount ${SOURCE} /mnt/
mount ${DEST} /mnt2/
rsync -a /mnt/ /mnt2/
cat <<EOF
   edit /mnt/etc/network/interfaces and /etc/hostname
   and then exit
EOF
bash
umount /mnt
umount /mnt2
/dev/pts/1
11:56:50
#pvdisplay
  --- Physical volume ---
  PV Name               /dev/md1
  VG Name               VG0
  PV Size               4,65 GiB / not usable 1,18 MiB
  Allocatable           yes
  PE Size               4,00 MiB
  Total PE              1191
  Free PE               167
  Allocated PE          1024
  PV UUID               hNOX7k-LiuG-UlxH-u7Rr-0Xhb-Q11G-27l408
/dev/pts/3
11:56:50
#pvdisplay
  --- Physical volume ---
  PV Name               /dev/md1
  VG Name               VG0
  PV Size               4,65 GiB / not usable 1,18 MiB
  Allocatable           yes
  PE Size               4,00 MiB
  Total PE              1191
  Free PE               167
  Allocated PE          1024
  PV UUID               hNOX7k-LiuG-UlxH-u7Rr-0Xhb-Q11G-27l408
/dev/pts/1
12:01:08
#vgdisplay
  --- Volume group ---
  VG Name               VG0
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  11
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               4,65 GiB
  PE Size               4,00 MiB
  Total PE              1191
  Alloc PE / Size       1024 / 4,00 GiB
  Free  PE / Size       167 / 668,00 MiB
  VG UUID               AhiA0l-KDWi-VnrA-wtlB-TVo1-EpHM-hBZx3w
/dev/pts/3
12:01:08
#vgdisplay
  --- Volume group ---
  VG Name               VG0
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  11
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               4,65 GiB
  PE Size               4,00 MiB
  Total PE              1191
  Alloc PE / Size       1024 / 4,00 GiB
  Free  PE / Size       167 / 668,00 MiB
  VG UUID               AhiA0l-KDWi-VnrA-wtlB-TVo1-EpHM-hBZx3w
/dev/pts/1
12:02:03
#pvdisplay
  --- Physical volume ---
  PV Name               /dev/md1
  VG Name               VG0
  PV Size               4,65 GiB / not usable 1,18 MiB
  Allocatable           yes
  PE Size               4,00 MiB
  Total PE              1191
  Free PE               167
  Allocated PE          1024
  PV UUID               hNOX7k-LiuG-UlxH-u7Rr-0Xhb-Q11G-27l408
/dev/pts/3
12:02:03
#pvdisplay
  --- Physical volume ---
  PV Name               /dev/md1
  VG Name               VG0
  PV Size               4,65 GiB / not usable 1,18 MiB
  Allocatable           yes
  PE Size               4,00 MiB
  Total PE              1191
  Free PE               167
  Allocated PE          1024
  PV UUID               hNOX7k-LiuG-UlxH-u7Rr-0Xhb-Q11G-27l408
/dev/pts/1
12:02:13
#history|grep file
  390  file -s /dev/sda7
  526  history|grep file
/dev/pts/3
12:02:13
#history|grep file
  390  file -s /dev/sda7
  526  history|grep file
/dev/pts/1
12:02:44
#file -s /dev/md1
/dev/md1: LVM2 (Linux Logical Volume Manager) , UUID: hNOX7kLiuGUlxHu7Rr0XhbQ11G27l40
/dev/pts/3
12:02:44
#file -s /dev/md1
/dev/md1: LVM2 (Linux Logical Volume Manager) , UUID: hNOX7kLiuGUlxHu7Rr0XhbQ11G27l40
/dev/pts/1
12:03:01
#md
bash: md: команда не найдена
/dev/pts/3
12:03:01
#md
bash: md: команда не найдена
/dev/pts/1
12:03:15
#mdadm show
mdadm: cannot open show: No such file or directory
/dev/pts/3
12:03:15
#mdadm show
mdadm: cannot open show: No such file or directory
/dev/pts/1
12:03:22
#mdadm --help
mdadm is used for building, managing, and monitoring
Linux md devices (aka RAID arrays)
Usage: mdadm --create device options...
            Create a new array from unused devices.
       mdadm --assemble device options...
            Assemble a previously created array.
       mdadm --build device options...
            Create or assemble an array without metadata.
       mdadm --manage device options...
            make changes to an existing array.
...
            Shorthand for --manage.
Any parameter that does not start with '-' is treated as a device name
or, for --examine-bitmap, a file name.
The first such name is often the name of an md device.  Subsequent
names are often names of component devices.
 For detailed help on the above major modes use --help after the mode
 e.g.
         mdadm --assemble --help
 For general help on options use
         mdadm --help-options
/dev/pts/3
12:03:22
#mdadm --help
mdadm is used for building, managing, and monitoring
Linux md devices (aka RAID arrays)
Usage: mdadm --create device options...
            Create a new array from unused devices.
       mdadm --assemble device options...
            Assemble a previously created array.
       mdadm --build device options...
            Create or assemble an array without metadata.
       mdadm --manage device options...