ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux lv(逻辑卷管理)

Linux lv(逻辑卷管理)

原创 Linux操作系统 作者:gydba 时间:2015-09-12 22:35:57 0 删除 编辑
前段时间对表空间进行重建整改,发现存储空间不足,随现在自己的虚拟机做了测试,现把linux创建vg及lv的进行下说明。
 
[root@mytest ~]# fdisk -l
Disk /dev/sda: 896.9 GB, 896998047744 bytes
255 heads, 63 sectors/track, 109053 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes


   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14      109053   875863800   8e  Linux LVM

Disk /dev/sdb: 1797.9 GB, 1797999558656 bytes
255 heads, 63 sectors/track, 218594 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes


可以看到这里有一个1.7t左右的盘,所以根据计算,我们的pe,应该是64m,即64*65536=4t
创建分区:
[root@mytest ~]# fdisk /dev/sdb
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 218594.
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): n
Command action
   e   extended
   p   primary partition (1-4)
p 
Partition number (1-4): 1
First cylinder (1-218594, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-218594, default 218594): 218594
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
重新扫描认一下盘
[root@mytest ~]# partprobe
[root@mytest ~]# df -h
文件系统              容量  已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-LogVol00
                      747G   64G  645G   9% /
/dev/sda1              99M   13M   82M  14% /boot
tmpfs                  32G     0   32G   0% /dev/shm
[root@mytest ~]# fdisk -l

Disk /dev/sda: 896.9 GB, 896998047744 bytes
255 heads, 63 sectors/track, 109053 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14      109053   875863800   8e  Linux LVM

Disk /dev/sdb: 1797.9 GB, 1797999558656 bytes
255 heads, 63 sectors/track, 218594 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      218594  1755856273+  83  Linux

创建逻辑盘:
[root@mytest ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
创建备份的vg,注意这里要加-s 64mb
[root@mytest ~]# vgcreate -s 64mb backupvg /dev/sdb1
  Volume group "backupvg" successfully created
创建备份用的lv
[root@mytest ~]# lvcreate -L 1600G -n backuplv01 backupvg
  Logical volume "backuplv01" created
创建挂载点
[root@mytest ~]# cd /u01
[root@mytest /]# mkdir -p /u02/databackup
[root@mytest /]# cd /dev/backupvg
[root@mytest backupvg]# ls -a
.  ..  backuplv01
格式化逻辑卷(linux5,只能格式化为ext3格式)
[root@mytest dev]# mkfs.ext3 /dev/backupvg/backuplv01
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
209715200 inodes, 419430400 blocks
20971520 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
12800 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, 20480000, 23887872, 71663616, 78675968, 
        102400000, 214990848


Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: 

进行挂载
[root@mytest dev]# mount /dev/backupvg/backuplv01 /u02/databackup


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30430420/viewspace-1798221/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: awr报告解读一
请登录后发表评论 登录
全部评论

注册时间:2015-08-24

  • 博文量
    77
  • 访问量
    192113