Linux lv(逻辑卷管理)

前段时间对表空间进行重建整改,发现存储空间不足,随现在自己的虚拟机做了测试,现把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)

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博客 ” ,链接:http://blog.itpub.net/30430420/viewspace-1798221/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30430420/viewspace-1798221/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值