今天给客户做一个vg,挂载到远程,供备份使用,现把linux创建vg及lv的进行下说明。
由于客户的数据量在增加,可能以后会再扩盘,所我们采用vg的方式,方便以后直接加盘
[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
由于本盘不是放置到数据库的机器上的,所以需要通过nfs挂载的方式进行共享
[root@mytest dev]# vi /etc/exports
添加:
/u02/databackup 192.168.10.*(rw,sync,no_root_squash)
打开nfs服务
[root@mytest dev]# service nfs start
注意,这里需要把iptables防火墙停止,否则可能连接不上!
在远程数据服务器进行挂载
[root@mydata ~]# mount 192.168.10.10:/u02/backup /u02/backup
将远端/u02/backup挂载到本地端的/u02/backup
这样就可以直接在oracle数据库部署备份了,当本地盘用了
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29371470/viewspace-1312731/
,如需转载,请注明出处,否则将追究法律责任。