Auth: Jin

Date: 20140317

需求
将NFS共享IP切换为192.168.201.221,通过192.168.201.0网段提供共享(10.0.0.0和192.168.201.0都能使用)
将NFS共享目录切换到/data/BackupPC/nfs/,这样纳入BackupPC备份

NFS 原来的配置
/data/backup/nfs 10.0.0.0/24(rw,sync,no_root_squash)
/data/backup/nfs/gbstore 10.0.0.0/24(rw,sync,no_root_squash)
/data/backup/nfs/gbdms 10.0.0.0/24(rw,sync,no_root_squash)
/data/backup/nfs/gbstock 10.0.0.0/24(rw,sync,no_root_squash)

操作
一、准备工作
1.NSF Server 221
rm -rf /data/BackupPC/nfs/ && rsync -av /data/backup/nfs/ /data/BackupPC/nfs/ && chown -R webroot.webroot /data/BackupPC/nfs/

cat >>/etc/exports << EOF
/data/BackupPC/nfs/gbstore 192.168.201.221(rw,sync,no_root_squash)
/data/BackupPC/nfs/gbdms 192.168.201.221(rw,sync,no_root_squash)
/data/BackupPC/nfs/gbstock 192.168.201.221(rw,sync,no_root_squash)
EOF
exportfs -av
2.测试 NSF clinet
247
# mount -t nfs 192.168.201.221:/data/BackupPC/nfs/gbstore /mnt/
mount: 192.168.201.221:/data/BackupPC/nfs/gbstore failed, reason given by server: Permission denied
子目录权限加了也提示没有权限
exportfs -r重新读取配置也没有权限

二、操作
1.NSF clinet 248,249
umount /home/gbstore/external_data
umount /home/gbdms/external_data
umount /home/gbstock/logs_sku_config

2.NSF Server 221
全部umount后服务器再同步和重启服务
rsync -av /data/backup/nfs/ /data/BackupPC/nfs/
chown -R webroot.webroot /data/BackupPC/nfs/
chown -R gbstore /data/BackupPC/nfs/gbstore
chown -R gbdms /data/BackupPC/nfs/gbdms
chown -R gbstock /data/BackupPC/nfs/gbstock
前面的exportfs -av之后无法挂载
/etc/init.d/nfs restart

3.NSF clinet mount 248,249
mount -t nfs 192.168.201.221:/data/BackupPC/nfs/gbstore/ /home/gbstore/external_data/
mount -t nfs 192.168.201.221:/data/BackupPC/nfs/gbdms/ /home/gbdms/external_data/
mount -t nfs 192.168.201.221:/data/BackupPC/nfs/gbstock /home/gbstock/logs_sku_config/

4.加入fstab

实际操作问题:

没有权限是我自己网段写错了

/data/BackupPC/nfs/gbstore      192.168.201.0/24(rw,sync,no_root_squash)
/data/BackupPC/nfs/gbdms        192.168.201.0/24(rw,sync,no_root_squash)
/data/BackupPC/nfs/gbstock      192.168.201.0/24(rw,sync,no_root_squash)umount报错

[root@JQ-pdt-host-248 ~]# umount /home/gbstore/external_data && mount -t nfs 192.168.201.221:/data/BackupPC/nfs/gbstore/ /home/gbstore/external_data/
umount: /home/gbstore/external_data: device is busy
umount: /home/gbstore/external_data: device is busy

改进操作

二、操作
1.NSF Server 221
全部umount后服务器再同步和重启服务
rsync -av /data/backup/nfs/ /data/BackupPC/nfs/ && chown -R webroot.webroot /data/BackupPC/nfs/ && chown -R gbstore /data/BackupPC/nfs/gbstore && chown -R gbdms /data/BackupPC/nfs/gbdms && chown -R gbstock /data/BackupPC/nfs/gbstock
&& exportfs -r

2.NSF clinet mount 248,249
shell
/etc/init.d/nginx stop && /etc/init.d/php-fpm stop
if [ $? -eq 0 ];then
  umount /home/gbstore/external_data && mount -t nfs 192.168.201.221:/data/BackupPC/nfs/gbstore/ /home/gbstore/external_data/;
  umount /home/gbdms/external_data && mount -t nfs 192.168.201.221:/data/BackupPC/nfs/gbdms/ /home/gbdms/external_data/;
  umount /home/gbstock/logs_sku_config && mount -t nfs 192.168.201.221:/data/BackupPC/nfs/gbstock /home/gbstock/logs_sku_config/
  if [ $(df|grep tmpfs |wc -l) -eq 6 ];then
    /etc/init.d/php-fpm start && /etc/init.d/nginx start
  else
    echo 'mount fail'
  fi
esle
  echo 'stop service fail'
fi
3.加入fstab

NFS迁移的更多相关文章

  1. 通过virt-manager 利用NFS创建、迁移虚拟机2

    前面一篇文章介绍了利用NFS创建虚拟机的过程,本文就介绍下如何利用NFS对虚拟机进行动态迁移. 动态迁移就是把一台虚拟机在不停止其运行的情况下迁移到另一台物理机上.这看起来似乎不太可能,不过还好kvm ...

  2. kubernetes 数据持久化

    pod本身是无状态,所以很多有状态的应用,就需要将数据进行持久化. 1:将数据挂在到宿主机.但是pod重启之后有可能到另外一个节点,这样数据虽然不会丢但是还是有可能会找不到 apiVersion: v ...

  3. 通过virt-manager 利用NFS创建、迁移虚拟机1

    NFS作为一种网络文件系统,近些年随着云计算的发展也变得越来越受欢迎.因为云环境下会部署大量的虚拟机,而在物理机发生故障的时候,云服务商必须要保障虚拟机的安全性,即不能因为物理机的故障就停止虚拟机.这 ...

  4. 基于NFS共享存储实现KVM虚拟机动态迁移

    基于NFS共享存储实现KVM虚拟机动态迁移 一:配置环境 二:安装相关的依赖包 三:实现NFS共享存储 四:KVM机配置相同的步骤 五:安装KVM01安装虚拟机 六:实现迁移  实验初始配置:所有主机 ...

  5. NFS存储迁移至GlusterFS

    NFS存储迁移至GlusterFS 前提条件 为防止脑裂,建议使用最低3台节点制作3复制集的存储卷: 在进行存储迁移前,GluseterFS存储节点需先成为k8s集群中的node节点: 存储切换时请勿 ...

  6. kvm安装window系统及使用NFS动态迁移

    验证是否开启虚拟化 # grep -E 'svm|vmx' /proc/cpuinfo - vmx is for Intel processors - svm is for AMD processor ...

  7. NFS网络共享服务部署

    10.3 NFS服务端部署环境准备 10.3.1 NFS服务部署服务器准备 服务器系统 角色 IP Centos6.7 x86_64 NFS服务器端(NFS-server) 192.168.1.14 ...

  8. kvm虚拟机静态和动态迁移

    一.kvm虚拟机静态迁移 1.静态迁移就是虚拟机在关机状态下,拷贝虚拟机虚拟磁盘文件与配置文件到目标虚拟主机中,实现的迁移. (1)虚拟主机各自使用本地存储存放虚拟机磁盘文件 本文实现基于本地磁盘存储 ...

  9. NFSv4的引用,迁移和备份(用户手册 v0.2)

    RFC3530 定义了NFS文件系统迁移和引用的管理机制.文件系统定位功能通过fs_location属性向客户端提供文件系统的位置信息.fs_location属 性是一个包含有位置信息的列表,位置信息 ...

随机推荐

  1. U-Boot启动过程完全分析<转>

    转载自:http://www.cnblogs.com/heaad/archive/2010/07/17/1779829.html 1.1       U-Boot工作过程 U-Boot启动内核的过程可 ...

  2. 【ZJOI2016】大森林

    这题理论上可以用ETT,但是用LCT建虚点可以解决这个问题. 对于最晚的操作1建立一个虚点,然后把操作0挂上去. #include<bits/stdc++.h> ; using names ...

  3. C语言 ,两个字符串参数,判断是否包含另一个字符串,返回所在位置

    char * cyp(char *s1,char *s2) { char *p = NULL; char *q = NULL; char *q1 = NULL; while(*s1!='\0') { ...

  4. Spiral Matrix I&&II

    Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral or ...

  5. Linux下安装PHP环境(非集成)

    一.安装Apache1.到官网下载  http://httpd.apache.org/download.cgi    2.安装apache [root@localhost 52lamp]# mkdir ...

  6. 用webpy实现12306余票查询

    效果

  7. Razor 部分页面

    最近在和师父一起打野,后台要求挺多的.后台还是用的EF和MVC5,页面使用的razor. 现在是发现好多的页面有太多重复的东西了. 比如说查询页面的字段,比如说列表页,比如说详情方法都有. 灵机一动, ...

  8. sublime text按esc经常进入command mode(不能输入任何东西)

    在使用sublime text进行 选中 操作中,如果使用了esc退出选中状态,会进入command mode,现象是不能输入任何东西,关闭当前编辑文件重新打开可以解决.但是很影响连贯性.可以通过一些 ...

  9. vue-music 关于基础组件 (Tab组件)

      定义在项目的基础组类别的 tab组件中,定义一个tab切换数量的数组 和一个currentIndex 当前高亮索引 的props,当前高亮(active)的类等于currentIndex === ...

  10. RecyclerView 和 ListView 使用对比分析

    原文地址:http://blog.coderclock.com/2016/08/08/android/RecyclerView%20%E5%92%8C%20ListView%20%E4%BD%BF%E ...