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

Содержание

Журнал

Вторник (02/21/12)

/dev/pts/4
13:41:05
#pvdisplay
  --- Physical volume ---
  PV Name               /dev/md0
  VG Name               VG0
  PV Size               4.66 GiB / not usable 260.00 KiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              1192
  Free PE               1192
  Allocated PE          0
  PV UUID               EO3JYK-SH1x-FKhg-Q28x-0IEz-350u-94jgIR
13:42:08
#vgdisplay
  --- Volume group ---
  VG Name               VG0
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               4.66 GiB
  PE Size               4.00 MiB
  Total PE              1192
  Alloc PE / Size       0 / 0
  Free  PE / Size       1192 / 4.66 GiB
  VG UUID               1shb9G-HVgI-8P40-8jqi-D92G-rkmk-tnth3W
13:47:47
#lvrename /dev/VG0/vol1 /dev/VG0/3d-games
  Renamed "vol1" to "3d-games" in volume group "VG0"
13:48:34
#lvdisplay
  --- Logical volume ---
  LV Name                /dev/VG0/3d-games
  VG Name                VG0
  LV UUID                uoJDfW-wBtO-D69O-uGtF-bJ49-92ok-2T7TfO
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                1.00 GiB
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
13:48:47
#mkfs.ext3 /dev/VG0/3d-games
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
13:49:41
#fs
fsadm         fsck.ext2     fsck.ext4dev  fsck.nfs      fstab-decode
fsck          fsck.ext3     fsck.minix    fsck.vfat     fstobdf
fsck.cramfs   fsck.ext4     fsck.msdos    fslsfonts     fstopgm
13:49:41
#dpkg -L lvm2 | grep bin/fs
/sbin/fsadm
13:50:15
#man fsadm
13:50:19
#fsadm --help
fsadm: Utility to resize or check the filesystem on a device
  fsadm [options] check device
    - Check the filesystem on device using fsck
  fsadm [options] resize device [new_size[BKMGTPE]]
    - Change the size of the filesystem on device to new_size
  Options:
    -h | --help         Show this help message
    -v | --verbose      Be verbose
    -e | --ext-offline  unmount filesystem before ext2/ext3/ext4 resize
    -f | --force        Bypass sanity checks
    -n | --dry-run      Print commands without running them
    -l | --lvresize     Resize given device (if it is LVM device)
    -y | --yes          Answer "yes" at any prompts
  new_size - Absolute number of filesystem blocks to be in the filesystem,
             or an absolute size using a suffix (in powers of 1024).
             If new_size is not supplied, the whole device is used.
13:50:46
#file `which fsadm `
/sbin/fsadm: Bourne-Again shell script text executable
13:50:52
#less `which fsadm `
13:51:02
#lvdisplay
  --- Logical volume ---
  LV Name                /dev/VG0/3d-games
  VG Name                VG0
  LV UUID                uoJDfW-wBtO-D69O-uGtF-bJ49-92ok-2T7TfO
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                1.00 GiB
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
13:51:12
#mount /dev/VG0/3d-games /mnt

13:51:19
#df -h /mnt
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VG0-3d--games
                     1008M   34M  924M   4% /mnt
13:51:21
#lvextend -L 1G /dev/VG0/3d-games
  New size (256 extents) matches existing size (256 extents)
  Run `lvextend --help' for more information.
13:52:19
#lvextend -L +1G /dev/VG0/3d-games
  Extending logical volume 3d-games to 2.00 GiB
  Logical volume 3d-games successfully resized
13:52:51
#df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              46G  4.2G   40G  10% /
tmpfs                 4.0G     0  4.0G   0% /lib/init/rw
udev                  4.0G  216K  4.0G   1% /dev
tmpfs                 4.0G     0  4.0G   0% /dev/shm
/dev/mapper/VG0-3d--games
                     1008M   34M  924M   4% /mnt
13:53:12
#apt-cache search ext2 resize
libparted0-dev - The GNU Parted disk partitioning library development files
libparted0-i18n - The GNU Parted disk partitioning library i18n support
libparted0debian1-dbg - The GNU Parted disk partitioning library debug development files
libparted0debian1 - The GNU Parted disk partitioning shared library
parted - The GNU Parted disk partition resizing program
partitionmanager - A partition management utility
13:53:26
#apt-cache search ext2 online

13:53:42
#fsadm --help
fsadm: Utility to resize or check the filesystem on a device
  fsadm [options] check device
    - Check the filesystem on device using fsck
  fsadm [options] resize device [new_size[BKMGTPE]]
    - Change the size of the filesystem on device to new_size
  Options:
    -h | --help         Show this help message
    -v | --verbose      Be verbose
    -e | --ext-offline  unmount filesystem before ext2/ext3/ext4 resize
    -f | --force        Bypass sanity checks
    -n | --dry-run      Print commands without running them
    -l | --lvresize     Resize given device (if it is LVM device)
    -y | --yes          Answer "yes" at any prompts
  new_size - Absolute number of filesystem blocks to be in the filesystem,
             or an absolute size using a suffix (in powers of 1024).
             If new_size is not supplied, the whole device is used.
13:53:46
#fsadm -l /dev/VG0/3d-games
fsadm: Wrong argument "/dev/VG0/3d-games". (see: fsadm --help)
13:54:01
#apt-cache search ext2
libattr1-dev - Extended attribute static libraries and headers
autopsy - graphical interface to SleuthKit
awesfx - utility programs for AWE32/64 and Emu10k1 driver
dump - 4.4bsd dump and restore for ext2 filesystems
e2fsck-static - statically-linked version of the ext2/ext3/ext4 filesystem checker
e2fslibs-dbg - debugging information for e2fslibs
e2fslibs-dev - ext2/ext3/ext4 file system libraries - headers and static libraries
e2fslibs - ext2/ext3/ext4 file system libraries
e2fsprogs - ext2/ext3/ext4 file system utilities
e2tools - utilities for manipulating files in an ext2/ext3 filesystem
...
scalpel - A Frugal, High Performance File Carver
syslinux-themes-debian-lenny - collection of boot loaders (debian-lenny theme)
syslinux-themes-debian-squeeze - collection of boot loaders (debian-squeeze theme)
syslinux-themes-debian - collection of boot loaders (theme metapackage)
extlinux - collection of boot loaders (ext2/3/4 and btrfs bootloader)
syslinux-common - collection of boot loaders (common files)
syslinux - collection of boot loaders
testdisk - Partition scanner and disk recovery tool
vdr-plugin-skinenigmang - Skin plugin for VDR
zerofree - zero free blocks from ext2/3 file-systems
13:54:50
#apt-get install e2fsprogs
Reading package lists... Done
Building dependency tree
Reading state information... Done
e2fsprogs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
13:54:55
#dpkg -L e2fsprogs
/.
/etc
/etc/mke2fs.conf
/usr
/usr/bin
/usr/bin/chattr
/usr/bin/lsattr
/usr/lib
/usr/lib/e2initrd_helper
/usr/share
...
/sbin/mkfs.ext2
/sbin/e2undo
/sbin/e2fsck
/sbin/debugfs
/sbin/resize2fs
/sbin/fsck.ext4dev
/sbin/mke2fs
/sbin/logsave
/sbin/fsck.ext2
/sbin/tune2fs
13:54:57
#resize2fs /dev/VG0/3d-games
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/VG0/3d-games is mounted on /mnt; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/VG0/3d-games to 524288 (4k) blocks.
The filesystem on /dev/VG0/3d-games is now 524288 blocks long.
13:55:15
#df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              46G  4.2G   40G  10% /
tmpfs                 4.0G     0  4.0G   0% /lib/init/rw
udev                  4.0G  216K  4.0G   1% /dev
tmpfs                 4.0G     0  4.0G   0% /dev/shm
/dev/mapper/VG0-3d--games
                      2.0G   34M  1.9G   2% /mnt
13:56:40
#lvextend -L +1G /dev/VG0/3d-games
  Extending logical volume 3d-games to 3.00 GiB
  Logical volume 3d-games successfully resized
13:56:44
#fsadm resize /dev/VG0/3d-games
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/dm-0 is mounted on /mnt; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/dm-0 to 786432 (4k) blocks.
The filesystem on /dev/dm-0 is now 786432 blocks long.
13:56:49
#df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              46G  4.2G   40G  10% /
tmpfs                 4.0G     0  4.0G   0% /lib/init/rw
udev                  4.0G  216K  4.0G   1% /dev
tmpfs                 4.0G     0  4.0G   0% /dev/shm
/dev/mapper/VG0-3d--games
                      3.0G   34M  2.8G   2% /mnt
13:58:16
#cfdisk /dev/sda
13:59:26
#cfdisk /dev/sda
14:00:39
#partprobe

14:00:52
#ls -l /dev/sda7
brw-rw---- 1 root disk 8, 7 Feb 21 15:00 /dev/sda7
14:01:31
#pvcreate /dev/sda7
  Physical volume "/dev/sda7" successfully created
14:03:58
#vgextend /dev/VG0 /dev/sda7
  Volume group "VG0" successfully extended
14:04:11
#vgdisplay
  --- Volume group ---
  VG Name               VG0
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               9.31 GiB
  PE Size               4.00 MiB
  Total PE              2384
  Alloc PE / Size       768 / 3.00 GiB
  Free  PE / Size       1616 / 6.31 GiB
  VG UUID               1shb9G-HVgI-8P40-8jqi-D92G-rkmk-tnth3W
14:04:54
#lvcreate -L 8G -n ddd /dev/VG0
  Insufficient free extents (1616) in volume group VG0: 2048 required
14:05:32
#lvcreate -L5G -n ddd /dev/VG0
  Logical volume "ddd" created
14:05:39
#lvremove /dev/VG0/ddd
Do you really want to remove active logical volume ddd? [y/n]: y
  Logical volume "ddd" successfully removed
14:09:21
#pvmove /dev/sda7
  No data to move for VG0
14:09:31
#lvcreate -L1G -n ddd /dev/VG0
  Logical volume "ddd" created
14:09:51
#mkfs.ext3 /dev/VG0/ddd
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
14:10:06
#pvmove /dev/md0
  /dev/md0: Moved: 0.1%
  /dev/md0: Moved: 8.8%
  /dev/md0: Moved: 17.5%
  /dev/md0: Moved: 26.1%
  /dev/md0: Moved: 34.7%
  /dev/md0: Moved: 43.3%
  /dev/md0: Moved: 52.0%
  /dev/md0: Moved: 60.5%
  /dev/md0: Moved: 69.0%
  /dev/md0: Moved: 75.0%
  /dev/md0: Moved: 83.8%
  /dev/md0: Moved: 92.4%
  /dev/md0: Moved: 100.0%
14:13:51
#pvmove /dev/sda7
  /dev/sda7: Moved: 0.1%
  /dev/sda7: Moved: 8.7%
  /dev/sda7: Moved: 17.4%
  /dev/sda7: Moved: 25.9%
  /dev/sda7: Moved: 34.5%
  /dev/sda7: Moved: 43.2%
  /dev/sda7: Moved: 51.8%
^[[A^[[  /dev/sda7: Moved: 60.4%
  /dev/sda7: Moved: 68.9%
  /dev/sda7: Moved: 75.0%
  /dev/sda7: Moved: 83.7%
  /dev/sda7: Moved: 92.5%
  /dev/sda7: Moved: 100.0%
14:17:32
#vgreduce /dev/VG0
  Please enter physical volume paths or option -a
  Run `vgreduce --help' for more information.
14:17:42
#vgreduce /dev/VG0 /dev/sda7
  Removed "/dev/sda7" from volume group "VG0"
прошло 55 минут
15:13:31
#lvremove /dev/VG0/ddd
Do you really want to remove active logical volume ddd? [y/n]: y
  Logical volume "ddd" successfully removed
15:13:36
#lvdisplay
  --- Logical volume ---
  LV Name                /dev/VG0/3d-games
  VG Name                VG0
  LV UUID                uoJDfW-wBtO-D69O-uGtF-bJ49-92ok-2T7TfO
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                3.00 GiB
  Current LE             768
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0
15:13:37
#lvrename /dev/VG0/3d-games /dev/VG0/vol1
  Renamed "3d-games" to "vol1" in volume group "VG0"
15:13:49
#lvcreate -L 100M -n snap1 -s /dev/VG0/vol1
  Logical volume "snap1" created
15:16:56
#lvs -a
  LV    VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  snap1 VG0  swi-a- 100.00m vol1     0.01
  vol1  VG0  owi-ao   3.00g
15:18:11
#mount
/dev/sda1 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
/dev/mapper/VG0-3d--games on /mnt type ext3 (rw)
15:18:58
#umount /mnt

15:19:16
#lvs -a
  LV    VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  snap1 VG0  swi-a- 100.00m vol1     0.01
  vol1  VG0  owi-a-   3.00g
15:19:23
#mount /dev/VG0/vol1 /mnt

15:19:28
#touch /mnt/XXX

15:19:38
#umount /mnt

15:19:42
#mount /dev/VG0/snap1 /mnt

15:19:51
#ls /mnt
lost+found
15:19:53
#umount /mnt

15:22:08
#mount /dev/VG0/vol1 /mnt

15:23:09
#lvcreate -L 100M -n snap1 -s /dev/VG0/vol1
  Logical volume "snap1" created
15:23:40
#lvcreate -L 100M -n snap1 -s /dev/VG0/vol1
                                          2
  Logical volume "snap2" created
15:23:59
#lvcreate -L 100M -n snap2 -s /dev/VG0/vol1
                                          3
  Logical volume "snap3" created
15:24:06
#lvcreate -L 100M -n snap4 -s /dev/VG0/vol1
  Logical volume "snap4" created
15:24:33
#lvremove /dev/VG0/snap1
Do you really want to remove active logical volume snap1? [y/n]: y
  Logical volume "snap1" successfully removed
15:24:44
#lvremove /dev/VG0/snap2
Do you really want to remove active logical volume snap2? [y/n]: y
  Logical volume "snap2" successfully removed
15:24:46
#lvs -a
  LV    VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  snap3 VG0  swi-a- 100.00m vol1    60.49
  snap4 VG0  swi-a- 100.00m vol1    60.49
  vol1  VG0  owi-ao   3.00g
15:24:49
#lvremove /dev/VG0/snap3
Do you really want to remove active logical volume snap3? [y/n]: y
  Logical volume "snap3" successfully removed
15:25:06
#lvremove /dev/VG0/snap3
                    s -a
  LV    VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  snap4 VG0  swi-a- 100.00m vol1    80.64
  vol1  VG0  owi-ao   3.00g
15:25:08
#lvremove /dev/VG0/snap3

15:25:16
#lvs -a
  /dev/dm-8: read failed after 0 of 4096 at 0: Input/output error
  LV    VG   Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  snap4 VG0  Swi-I- 100.00m vol1   100.00
  vol1  VG0  owi-ao   3.00g
15:25:18
#umount /mnt

15:25:49
#mount /dev/VG0/snap4 /mnt
mount: /dev/mapper/VG0-snap4: can't read superblock
15:26:07
#lvremove /dev/VG0/snap4
  /dev/dm-8: read failed after 0 of 4096 at 0: Input/output error
Do you really want to remove active logical volume snap4? [y/n]: y
  Logical volume "snap4" successfully removed
15:26:21
#mount /dev/VG0/snap4 /mnt
mount: special device /dev/VG0/snap4 does not exist
15:26:30
#mount /dev/VG0/vol1 /mnt

15:27:32
#apt-cache search system-config-lvm
system-config-lvm - A utility for graphically configuring Logical Volumes
15:28:21