Linux LVM测试(测试)

[Nova@localhost var]# fdisk -l

Disk /dev/cciss/c0d0: 440.3 GB, 440346238976 bytes
255 heads, 63 sectors/track, 53535 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/cciss/c0d0p1 * 1 522 4192933+ 83 Linux
/dev/cciss/c0d0p2 523 1044 4192965 82 Linux swap
/dev/cciss/c0d0p3 1045 1566 4192965 83 Linux
/dev/cciss/c0d0p4 1567 53535 417440992+ 5 Extended
/dev/cciss/c0d0p5 1567 2219 5245191 83 Linux
/dev/cciss/c0d0p6 2220 53535 412195738+ 83 Linux
[Nova@localhost var]# umount /opt
[Nova@localhost var]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p1 4.0G 219M 3.6G 6% /
none 3.9G 21M 3.9G 1% /dev/shm
/dev/cciss/c0d0p5 5.0G 2.2G 2.6G 47% /usr
/dev/cciss/c0d0p3 4.0G 3.0G 853M 78% /var
/dev/shm 3.9G 21M 3.9G 1% /tmp
[Nova@localhost var]#
[Nova@localhost var]# pvcreate /dev/cciss/c0d0p6
Physical volume "/dev/cciss/c0d0p6" successfully created
[Nova@localhost var]#
[Nova@localhost var]# pvdisplay -v
Scanning for physical volume names
Wiping cache of LVM-capable devices
"/dev/cciss/c0d0p6" is a new physical volume of "393.10 GB"
--- NEW Physical volume ---
PV Name /dev/cciss/c0d0p6
VG Name
PV Size 393.10 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID z7fGFG-V27e-U43e-TMMZ-eJim-ql5u-dsJvGx

[Nova@localhost var]# vgcreate mysqldata /dev/cciss/c0d0p6
Volume group "mysqldata" successfully created
[Nova@localhost var]#
[Nova@localhost var]# vgdisplay -v
Finding all volume groups
Finding volume group "mysqldata"
--- Volume group ---
VG Name mysqldata
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 393.10 GB
PE Size 4.00 MB
Total PE 100633
Alloc PE / Size 0 / 0
Free PE / Size 100633 / 393.10 GB
VG UUID VHxioJ-TWgu-dWx5-KnvK-Dh9W-SO7r-6scPFA

--- Physical volumes ---
PV Name /dev/cciss/c0d0p6
PV UUID z7fGFG-V27e-U43e-TMMZ-eJim-ql5u-dsJvGx
PV Status allocatable
Total PE / Free PE 100633 / 100633

[Nova@localhost var]#
[Nova@localhost var]# lvcreate -L 60G -n mysql mysqldata
Logical volume "mysql" created
[Nova@localhost var]# lvdisplay -v
Finding all logical volumes
--- Logical volume ---
LV Name /dev/mysqldata/mysql
VG Name mysqldata
LV UUID qThRXw-4izL-PFyo-v1N6-y7I8-nCC5-l3fTwM
LV Write Access read/write
LV Status available
# open 0
LV Size 60.00 GB
Current LE 15360
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

[Nova@localhost var]# mkfs.ext3 -j /dev/mysqldata/mysql
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
7864320 inodes, 15728640 blocks
786432 blocks (5.00%) reserved for the super user
First da

ta block=0
Maximum filesystem blocks=4294967296
480 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424

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.
[Nova@localhost var]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p1 4.0G 220M 3.6G 6% /
none 3.9G 21M 3.9G 1% /dev/shm
/dev/cciss/c0d0p5 5.0G 2.2G 2.6G 47% /usr
/dev/cciss/c0d0p3 4.0G 3.0G 853M 78% /var
/dev/shm 3.9G 21M 3.9G 1% /tmp
[Nova@localhost var]# mount /dev/mysqldata/mysql /opt
[Nova@localhost var]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p1 4.0G 220M 3.6G 6% /
none 3.9G 21M 3.9G 1% /dev/shm
/dev/cciss/c0d0p5 5.0G 2.2G 2.6G 47% /usr
/dev/cciss/c0d0p3 4.0G 3.0G 853M 78% /var
/dev/shm 3.9G 21M 3.9G 1% /tmp
/dev/mapper/mysqldata-mysql
60G 84M 56G 1% /opt

[Nova@localhost var]# mount /dev/mysqldata/mysql /opt
[Nova@localhost var]#
[Nova@localhost var]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p1 4.0G 220M 3.6G 6% /
none 3.9G 21M 3.9G 1% /dev/shm
/dev/cciss/c0d0p5 5.0G 2.2G 2.6G 47% /usr
/dev/cciss/c0d0p3 4.0G 3.0G 853M 78% /var
/dev/shm 3.9G 21M 3.9G 1% /tmp
/dev/mapper/mysqldata-mysql
60G 84M 56G 1% /opt
[Nova@localhost var]#
[Nova@localhost var]#
[Nova@localhost var]#
[Nova@localhost var]# cp -R /var/tmp_nova/* /opt
[Nova@localhost var]#
[Nova@localhost var]# ls -ltr
total 164
drwxr-xr-x 2 root root 4096 Aug 13 2004 preserve
drwxr-xr-x 2 root root 4096 Aug 13 2004 opt
drwxr-xr-x 2 root root 4096 Aug 13 2004 nis
drwxr-xr-x 2 root root 4096 Aug 13 2004 local
lrwxrwxrwx 1 root root 10 Jul 1 17:28 mail -> spool/mail
drwxr-xr-x 3 netdump netdump 4096 Jul 1 17:29 crash
drwxr-xr-x 3 root root 4096 Jul 1 17:29 empty
drwxr-xr-x 13 root root 4096 Jul 1 17:29 spool
drwxr-xr-x 3 root root 4096 Jul 1 17:29 yp
drwxr-xr-x 3 root root 4096 Jul 1 17:31 state
drwxr-xr-x 7 root root 4096 Jul 1 17:31 cache
lrwxrwxrwx 1 root root 4 Jul 1 17:32 tmp -> /tmp
drwx------ 2 root root 16384 Jul 2 01:28 lost+found
drwxr-xr-x 4 root root 4096 Jul 15 11:21 db
drwxr-xr-x 10 root root 4096 Jul 19 04:02 log
drwxr-xr-x 17 root root 4096 Jul 20 17:38 run
drwxr-xr-x 2 root root 4096 Jul 20 17:38 net-snmp
drwxr-xr-x 20 root root 4096 Jul 22 19:18 lib
drwxrwxr-x 6 root lock 4096 Jul 24 04:02 lock
drwxr-xr-x 2 root root 4096 Jul 24 04:02 account
drwxr-xr-x 3 root root 4096 Jul 24 10:47 tmp_nova
[Nova@localhost var]#
[Nova@localhost var]# cd /opt
[Nova@localhost opt]#
[Nova@localhost opt]# ls
dbbak MySQL-client-community-5.0.83-0.rhel4.i386.rpm MySQL-shared-community-5.0.83-0.rhel3.i386.rpm
lost+found MySQL-server-community-5.0.83-0.rhel3.i386.rpm
[Nova@localhost opt]#
[Nova@localhost opt]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/cciss/c0d0p1 4127076 224260 3693172 6% /
none 4088400 20560 4067840 1% /dev/shm
/dev/cciss/c0d0p5 5162796 2270656 2629884 47% /usr
/dev/cciss/c0d0p3 4127108 3044216 873244 78% /var
/dev/shm 4088400 20560 4067840 1% /tmp
/dev/mapper/mysqldata-mysql
61927420 1561100 57220592 3% /opt
[Nova@localhost opt]#
[Nova@localhost opt]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p1 4.0G 220M 3.6G 6% /
none 3.9G 21M 3.9G 1% /dev/shm
/dev/cciss/c0d0p5 5.0G 2.2G 2.6G 47% /usr
/dev/cciss/c0d0p3 4.0G 3.0G 853M 78% /var
/dev/shm 3.9G 21M 3.9G 1% /tmp
/dev/mapper/mysqldata-mysql
60G 1.5G 55G 3% /opt
[Nova@localhost opt]#
[Nova@localhost opt]# time lvcreate -L 2G -s -n snap /dev/mysqldata/mysql
Logical volume "snap" created

real 0m0.097s
user 0m0.005s
sys 0m0.046s
[Nova@localhost opt]#
[Nova@localhost opt]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p1 4.0G 220M 3.6G 6% /
none 3.9G 21M 3.9G 1% /dev/shm
/dev/cciss/c0d0p5 5.0G 2.2G 2.6G 47% /usr
/dev/cciss/c0d0p3 4.0G 3.0G 853M 78% /var
/dev/shm 3.9G 21M 3.9G 1% /tmp
/dev/mapper/mysqldata-mysql
60G 1.5G 55G 3% /opt
[Nova@localhost opt]#
[Nova@localhost opt]# mount /dev/mysqldata/snap
[Nova@localhost opt]# mkdir /snap
[Nova@localhost opt]#
[Nova@localhost opt]# mount /dev/mysqldata/snap /snap
[Nova@localhost opt]#
[Nova@localhost opt]# cd /snap/
[Nova@localhost snap]#
[Nova@localhost snap]# ls
dbbak MySQL-client-community-5.0.83-0.rhel4.i386.rpm MySQL-shared-community-5.0.83-0.rhel3.i386.rpm
lost+found MySQL-server-community-5.0.83-0.rhel3.i386.rpm
[Nova@localhost snap]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p1 4.0G 220M 3.6G 6% /
none 3.9G 21M 3.9G 1% /dev/shm
/dev/cciss/c0d0p5 5.0G 2.2G 2.6G 47% /usr
/dev/cciss/c0d0p3 4.0G 3.0G 853M 78% /var
/dev/shm 3.9G 21M 3.9G 1% /tmp
/dev/mapper/mysqldata-mysql
60G 1.5G 55G 3% /opt
/dev/mapper/mysqldata-snap
60G 1.5G 55G 3% /snap
[Nova@localhost snap]# cd /;umount /snap/
[Nova@localhost /]#
[Nova@localhost /]# lvremove /dev/mysqldata/snap
Do you really want to remove active logical volume "snap"? [y/n]: y

Do you really want to remove active logical volume "snap"? [y/n]: Logical volume "snap" successfully removed
[Nova@localhost /]#
[Nova@localhost /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p1 4.0G 220M 3.6G 6% /
none 3.9G 21M 3.9G 1% /dev/shm
/dev/cciss/c0d0p5 5.0G 2.2G 2.6G 47% /usr
/dev/cciss/c0d0p3 4.0G 3.0G 853M 78% /var
/dev/shm 3.9G 21M 3.9G 1% /tmp
/dev/mapper/mysqldata-mysql
60G 1.5G 55G 3% /opt
[Nova@localhost /]#
[Nova@localhost /]#

[@54.21 software]# mount /dev/mapper/mysqldata-software /software/
[@54.21 software]# mount /dev/mapper/mysqldata-mysql /opt

你可能感兴趣的:(linux,mysql,cache,OS,Access)