LVM

原文链接: http://www.cnblogs.com/liweiming/p/7230692.html



 

Connecting to 172.16.122.208:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Wed Jul 19 01:50:42 2017 from 172.16.8.51
[mauser@localhost ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/rootvg-root
                      992M  350M  591M  38% /
/dev/mapper/rootvg-usr
                      9.7G  2.8G  6.5G  31% /usr
/dev/mapper/rootvg-opt
                      3.9G  137M  3.6G   4% /opt
/dev/mapper/rootvg-app
                       20G  173M   19G   1% /app
/dev/mapper/rootvg-var
                      3.9G  298M  3.4G   8% /var
/dev/mapper/rootvg-tmp
                      3.9G  137M  3.6G   4% /tmp
/dev/mapper/rootvg-home
                      3.9G  137M  3.6G   4% /home
/dev/mapper/oravg-oraclelv
                       40G  176M   38G   1% /u01
/dev/sda1             494M   18M  451M   4% /boot
tmpfs                 3.9G     0  3.9G   0% /dev/shm
[mauser@localhost ~]$ fdisk /dev/sd
sda   sda1  sda2  sdb   sdb1  
[mauser@localhost ~]$ init 6
-bash: init: command not found
[mauser@localhost ~]$ su -
Password: 
[root@localhost ~]# init 6
[root@localhost ~]# Connection closing...Socket close.
Connection closed by foreign host.
Disconnected from remote host(ora 172.16.122.208) at 18:36:35.
Type `help' to learn how to use Xshell prompt.
[d:\~]$ 
Connecting to 172.16.122.208:22...
Could not connect to '172.16.122.208' (port 22): Connection failed.
Type `help' to learn how to use Xshell prompt.
[d:\~]$ 
Connecting to 172.16.122.208:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Mon Jul 24 10:36:04 2017 from 172.16.8.51
[mauser@localhost ~]$ su -
Password: 
[root@localhost ~]# fdisk /dev/sd
sda   sda1  sda2  sdb   sdb1  sdc   
[root@localhost ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 6527.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): 
[root@localhost ~]# fdisk /dev/sdc
[root@localhost ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 6527.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdc: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-6527, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-6527, default 6527): 
Using default value 6527
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdc: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        6527    52428096   8e  Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/rootvg-root
                      992M  350M  591M  38% /
/dev/mapper/rootvg-usr
                      9.7G  2.8G  6.5G  31% /usr
/dev/mapper/rootvg-opt
                      3.9G  137M  3.6G   4% /opt
/dev/mapper/rootvg-app
                       20G  173M   19G   1% /app
/dev/mapper/rootvg-var
                      3.9G  296M  3.4G   8% /var
/dev/mapper/rootvg-tmp
                      3.9G  137M  3.6G   4% /tmp
/dev/mapper/rootvg-home
                      3.9G  137M  3.6G   4% /home
/dev/mapper/oravg-oraclelv
                       40G  176M   38G   1% /u01
/dev/sda1             494M   18M  451M   4% /boot
tmpfs                 3.9G     0  3.9G   0% /dev/shm
[root@localhost ~]# pvcreate /dev/sd
sda   sda1  sda2  sdb   sdb1  sdc   sdc1  
[root@localhost ~]# pvcreate /dev/sdc1
  Writing physical volume data to disk "/dev/sdc1"
  Physical volume "/dev/sdc1" successfully created
[root@localhost ~]# pvs
  PV         VG     Fmt  Attr PSize  PFree 
  /dev/sda2  rootvg lvm2 a--  59.47G  4.47G
  /dev/sdb1  oravg  lvm2 a--  49.97G  9.97G
  /dev/sdc1         lvm2 a--  50.00G 50.00G
[root@localhost ~]# vgextend oravg /dev/sdc1
  Volume group "oravg" successfully extended
[root@localhost ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree 
  oravg    2   1   0 wz--n- 99.94G 59.94G
  rootvg   1   8   0 wz--n- 59.47G  4.47G
[root@localhost ~]# lvcreate -L 50G -n oradatalv oravg
  Logical volume "oradatalv" created
[root@localhost ~]# lvs
  LV        VG     Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  oraclelv  oravg  -wi-ao 40.00G                                      
  oradatalv oravg  -wi-a- 50.00G                                      
  app       rootvg -wi-ao 20.00G                                      
  home      rootvg -wi-ao  4.00G                                      
  opt       rootvg -wi-ao  4.00G                                      
  root      rootvg -wi-ao  1.00G                                      
  swap01    rootvg -wi-ao  8.00G                                      
  tmp       rootvg -wi-ao  4.00G                                      
  usr       rootvg -wi-ao 10.00G                                      
  var       rootvg -wi-ao  4.00G                                      
[root@localhost ~]# mkfs.ext4 /dev/oravg/oradatalv 
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3276800 inodes, 13107200 blocks
655360 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
400 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000, 7962624, 11239424
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:        
done
[root@localhost ~]# 
[root@localhost ~]# mkdir /oradata
[root@localhost ~]# chown oracle:oinstall /oradata
chown: `oracle:oinstall': invalid user
[root@localhost ~]# 
[root@localhost ~]# mount /dev/oravg/oradatalv /oradata/
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/rootvg-root
                      992M  350M  591M  38% /
/dev/mapper/rootvg-usr
                      9.7G  2.8G  6.5G  31% /usr
/dev/mapper/rootvg-opt
                      3.9G  137M  3.6G   4% /opt
/dev/mapper/rootvg-app
                       20G  173M   19G   1% /app
/dev/mapper/rootvg-var
                      3.9G  296M  3.4G   8% /var
/dev/mapper/rootvg-tmp
                      3.9G  137M  3.6G   4% /tmp
/dev/mapper/rootvg-home
                      3.9G  137M  3.6G   4% /home
/dev/mapper/oravg-oraclelv
                       40G  176M   38G   1% /u01
/dev/sda1             494M   18M  451M   4% /boot
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/mapper/oravg-oradatalv
                       50G  180M   47G   1% /oradata
[root@localhost ~]# vi /etc/fstab 
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/rootvg-root
                      992M  350M  591M  38% /
/dev/mapper/rootvg-usr
                      9.7G  2.8G  6.5G  31% /usr
/dev/mapper/rootvg-opt
                      3.9G  137M  3.6G   4% /opt
/dev/mapper/rootvg-app
                       20G  173M   19G   1% /app
/dev/mapper/rootvg-var
                      3.9G  296M  3.4G   8% /var
/dev/mapper/rootvg-tmp
                      3.9G  137M  3.6G   4% /tmp
/dev/mapper/rootvg-home
                      3.9G  137M  3.6G   4% /home
/dev/mapper/oravg-oraclelv
                       40G  176M   38G   1% /u01
/dev/sda1             494M   18M  451M   4% /boot
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/mapper/oravg-oradatalv
                       50G  180M   47G   1% /oradata
[root@localhost ~]# cd /oradata/
[root@localhost oradata]# ll
total 16
drwx------ 2 root root 16384 Jul 24 10:48 lost+found
[root@localhost oradata]# timed out waiting for input: auto-logout
[mauser@localhost ~]$ timed out waiting for input: auto-logout
Connection closing...Socket close.
Connection closed by foreign host.
Disconnected from remote host(ora 172.16.122.208) at 19:05:02.
Type `help' to learn how to use Xshell prompt.
[d:\~]$ 
Connecting to 172.16.122.208:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Mon Jul 24 10:38:30 2017 from 172.16.8.51
[mauser@localhost ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/rootvg-root
                      992M  350M  591M  38% /
/dev/mapper/rootvg-usr
                      9.7G  2.8G  6.5G  31% /usr
/dev/mapper/rootvg-opt
                      3.9G  137M  3.6G   4% /opt
/dev/mapper/rootvg-app
                       20G  173M   19G   1% /app
/dev/mapper/rootvg-var
                      3.9G  296M  3.4G   8% /var
/dev/mapper/rootvg-tmp
                      3.9G  137M  3.6G   4% /tmp
/dev/mapper/rootvg-home
                      3.9G  137M  3.6G   4% /home
/dev/mapper/oravg-oraclelv
                       40G  176M   38G   1% /u01
/dev/sda1             494M   18M  451M   4% /boot
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/mapper/oravg-oradatalv
                       50G  180M   47G   1% /oradata
[mauser@localhost ~]$ init 6
-bash: init: command not found
[mauser@localhost ~]$ su -
Password: 
[root@localhost ~]# init 6
[root@localhost ~]# Connection closing...Socket close.
Connection closed by foreign host.
Disconnected from remote host(ora 172.16.122.208) at 19:08:05.
Type `help' to learn how to use Xshell prompt.
[d:\~]$ 
Connecting to 172.16.122.208:22...
Could not connect to '172.16.122.208' (port 22): Connection failed.
Type `help' to learn how to use Xshell prompt.
[d:\~]$ 
Connecting to 172.16.122.208:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Mon Jul 24 11:07:27 2017 from 172.16.8.51
[mauser@localhost ~]$ su -
Password: 
[root@localhost ~]# fdisk /dev/sd
sda   sda1  sda2  sdb   sdb1  sdc   sdc1  sdd   
[root@localhost ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
The number of cylinders for this disk is set to 6527.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdd: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-6527, default 1): 
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-6527, default 6527): 
Using default value 6527
Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): p
Disk /dev/sdd: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        6527    52428096   8e  Linux LVM
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@localhost ~]# pvcreate /dev/sd
sda   sda1  sda2  sdb   sdb1  sdc   sdc1  sdd   sdd1  
[root@localhost ~]# pvcreate /dev/sdd1
  Writing physical volume data to disk "/dev/sdd1"
  Physical volume "/dev/sdd1" successfully created
[root@localhost ~]# pvs
  PV         VG     Fmt  Attr PSize  PFree 
  /dev/sda2  rootvg lvm2 a--  59.47G  4.47G
  /dev/sdb1  oravg  lvm2 a--  49.97G  9.94G
  /dev/sdc1  oravg  lvm2 a--  49.97G     0 
  /dev/sdd1         lvm2 a--  50.00G 50.00G
[root@localhost ~]# vgcreate mauservg /dev/sdd1 -s 64M
  Volume group "mauservg" successfully created
[root@localhost ~]# pvs
  PV         VG       Fmt  Attr PSize  PFree 
  /dev/sda2  rootvg   lvm2 a--  59.47G  4.47G
  /dev/sdb1  oravg    lvm2 a--  49.97G  9.94G
  /dev/sdc1  oravg    lvm2 a--  49.97G     0 
  /dev/sdd1  mauservg lvm2 a--  49.94G 49.94G
[root@localhost ~]# lvs
  LV        VG     Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  oraclelv  oravg  -wi-ao 40.00G                                      
  oradatalv oravg  -wi-a- 50.00G                                      
  app       rootvg -wi-ao 20.00G                                      
  home      rootvg -wi-ao  4.00G                                      
  opt       rootvg -wi-ao  4.00G                                      
  root      rootvg -wi-ao  1.00G                                      
  swap01    rootvg -wi-ao  8.00G                                      
  tmp       rootvg -wi-ao  4.00G                                      
  usr       rootvg -wi-ao 10.00G                                      
  var       rootvg -wi-ao  4.00G                                      
[root@localhost ~]# lvcreate -L 30G -n mauserlv mauservg
  Logical volume "mauserlv" created
[root@localhost ~]# lvs
  LV        VG       Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  mauserlv  mauservg -wi-a- 30.00G                                      
  oraclelv  oravg    -wi-ao 40.00G                                      
  oradatalv oravg    -wi-a- 50.00G                                      
  app       rootvg   -wi-ao 20.00G                                      
  home      rootvg   -wi-ao  4.00G                                      
  opt       rootvg   -wi-ao  4.00G                                      
  root      rootvg   -wi-ao  1.00G                                      
  swap01    rootvg   -wi-ao  8.00G                                      
  tmp       rootvg   -wi-ao  4.00G                                      
  usr       rootvg   -wi-ao 10.00G                                      
  var       rootvg   -wi-ao  4.00G                                      
[root@localhost ~]# mkfs.ext4 /dev/mauservg/mauserlv 
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1966080 inodes, 7864320 blocks
393216 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
240 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
4096000
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:        
done
[root@localhost ~]# 
[root@localhost ~]# mkdir /mauser
[root@localhost ~]# mount /dev/mauservg/mauserlv /mauser/
[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/rootvg-root
                      992M  351M  591M  38% /
/dev/mapper/rootvg-usr
                      9.7G  2.8G  6.5G  31% /usr
/dev/mapper/rootvg-opt
                      3.9G  137M  3.6G   4% /opt
/dev/mapper/rootvg-app
                       20G  173M   19G   1% /app
/dev/mapper/rootvg-var
                      3.9G  296M  3.4G   8% /var
/dev/mapper/rootvg-tmp
                      3.9G  137M  3.6G   4% /tmp
/dev/mapper/rootvg-home
                      3.9G  137M  3.6G   4% /home
/dev/mapper/oravg-oraclelv
                       40G  176M   38G   1% /u01
/dev/sda1             494M   18M  451M   4% /boot
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/mapper/mauservg-mauserlv
                       30G  172M   28G   1% /mauser
[root@localhost ~]# vi /etc/fstab 
[root@localhost ~]# timed out waiting for input: auto-logout
[mauser@localhost ~]$ su -
Password: 
[root@localhost ~]# vi /etc/fstab 
[root@localhost ~]# 

 

转载于:https://www.cnblogs.com/liweiming/p/7230692.html

你可能感兴趣的:(LVM)