1.         转移一个VG 到另外一个系统

Unmount the file system

First, make sure that no users are accessing files on the active volume, then unmount it

# unmount /mnt/design/users

Mark the volume group inactive

Marking the volume group inactive removes it from the kernel and prevents any further activity on it.

# vgchange -an design

vgchange -- volume group "design" successfully deactivated

Export the volume group

It is now necessary to export the volume group. This prevents it from being accessed on the ``old'' host system and prepares it to be removed.

# vgexport design

vgexport -- volume group "design" successfully exported

Import the volume group

When plugged into the new system it becomes /dev/sdb so an initial pvscan shows:

# pvscan

pvscan -- reading all physical volumes (this may take a while...)

pvscan -- inactive PV "/dev/sdb1"  is in EXPORTED VG "design" [996 MB / 996 MB free]

pvscan -- inactive PV "/dev/sdb2"  is in EXPORTED VG "design" [996 MB / 244 MB free]

pvscan -- total: 2 [1.95 GB] / in use: 2 [1.95 GB] / in no VG: 0 [0]

# vgimport design
Volume group "vg" successfully imported

Activate the volume group

You must activate the volume group before you can access it.

# vgchange -ay design

Mount the file system

# mkdir -p /mnt/design/users

# mount /dev/design/users /mnt/design/users

The file system is now available for use.

2.         分割一个vg

Determine free space

# pvscan

pvscan -- reading all physical volumes (this may take a while...)

pvscan -- ACTIVE   PV "/dev/sda"  of VG "dev"   [1.95 GB / 0 free]

pvscan -- ACTIVE   PV "/dev/sdb"  of VG "sales" [1.95 GB / 1.27 GB free]

pvscan -- ACTIVE   PV "/dev/sdc"  of VG "ops"   [1.95 GB / 564 MB free]

pvscan -- ACTIVE   PV "/dev/sdd"  of VG "dev"   [1.95 GB / 0 free]

pvscan -- ACTIVE   PV "/dev/sde"  of VG "ops"   [1.95 GB / 1.9 GB free]

pvscan -- ACTIVE   PV "/dev/sdf"  of VG "dev"   [1.95 GB / 1.33 GB free]

pvscan -- ACTIVE   PV "/dev/sdg1" of VG "ops"   [996 MB / 432 MB free]

pvscan -- ACTIVE   PV "/dev/sdg2" of VG "dev"   [996 MB / 632 MB free]

pvscan -- total: 8 [13.67 GB] / in use: 8 [13.67 GB] / in no VG: 0 [0]

Move data off the disks to be used

Some space is still used on the chosen volumes so it is necessary to move that used space off onto some others.

Move all the used physical extents from /dev/sdg1 to /dev/sde and from /dev/sdg2 to /dev/sdf

# pvmove /dev/sdg1 /dev/sde

pvmove -- moving physical extents in active volume group "ops"

pvmove -- WARNING: moving of active logical volumes may cause data loss!

pvmove -- do you want to continue? [y/n] y

pvmove -- doing automatic backup of volume group "ops"

pvmove -- 141 extents of physical volume "/dev/sdg1" successfully moved

# pvmove /dev/sdg2 /dev/sdf

pvmove -- moving physical extents in active volume group "dev"

pvmove -- WARNING: moving of active logical volumes may cause data loss!

pvmove -- do you want to continue? [y/n] y

pvmove -- doing automatic backup of volume group "dev"

pvmove -- 91 extents of physical volume "/dev/sdg2" successfully moved

Create the new volume group

Now, split /dev/sdg2 from dev and add it into a new group called "design". it is possible to do this using vgreduce and vgcreate but the vgsplit command combines the two.

# vgsplit dev design /dev/sdg2

vgsplit -- doing automatic backup of volume group "dev"

vgsplit -- doing automatic backup of volume group "design"

vgsplit -- volume group "dev" successfully split into "dev" and "design"

Remove remaining volume

Next, remove /dev/sdg1 from ops and add it into design.

# vgreduce ops /dev/sdg1

vgreduce -- doing automatic backup of volume group "ops"

vgreduce -- volume group "ops" successfully reduced by physical volume:

vgreduce -- /dev/sdg1

# vgextend design /dev/sdg1

vgextend -- INFO: maximum logical volume size is 255.99 Gigabyte

vgextend -- doing automatic backup of volume group "design"

vgextend -- volume group "design" successfully extended

Create new logical volume

Now create a logical volume. Rather than allocate all of the available space, leave some spare in case it is needed elsewhere.

# lvcreate -L750M -n users design

lvcreate -- rounding up size to physical extent boundary "752 MB"

lvcreate -- doing automatic backup of "design"

lvcreate -- logical volume "/dev/design/users" successfully created

Make a file system on the volume

# mke2fs /dev/design/users

mke2fs 1.18, 11-Nov-1999 for EXT2 FS 0.5b, 95/08/09

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

96384 inodes, 192512 blocks

9625 blocks (5.00<!-- ) reserved for the super user

First data block=0

6 block groups

32768 blocks per group, 32768 fragments per group

16064 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840

Writing inode tables: done

Writing superblocks and filesystem accounting information: done

Mount the new volume

# mkdir -p /mnt/design/users mount /dev/design/users /mnt/design/users/

It's also a good idea to add an entry for this file system in your /etc/fstab file as follows:

/dev/design/user

/mnt/design/users   ext2    defaults        1 2

转载于:https://blog.51cto.com/xiaoli110/642944

LVM-HOWTO/学习笔记(五)相关推荐

  1. python函数是一段具有特定功能的语句组_Python学习笔记(五)函数和代码复用

    本文将为您描述Python学习笔记(五)函数和代码复用,具体完成步骤: 函数能提高应用的模块性,和代码的重复利用率.在很多高级语言中,都可以使用函数实现多种功能.在之前的学习中,相信你已经知道Pyth ...

  2. Ethernet/IP 学习笔记五

    Ethernet/IP 学习笔记五 Accessing data within a device using a non-time critical message (an explicit mess ...

  3. StackExchange.Redis学习笔记(五) 发布和订阅

    StackExchange.Redis学习笔记(五) 发布和订阅 原文:StackExchange.Redis学习笔记(五) 发布和订阅 Redis命令中的Pub/Sub Redis在 2.0之后的版 ...

  4. 吴恩达《机器学习》学习笔记五——逻辑回归

    吴恩达<机器学习>学习笔记五--逻辑回归 一. 分类(classification) 1.定义 2.阈值 二. 逻辑(logistic)回归假设函数 1.假设的表达式 2.假设表达式的意义 ...

  5. 好程序员教程分析Vue学习笔记五

    好程序员教程分析Vue学习笔记五,上次我们学习了Vue的组件,这次我们来学习一下路由的使用.在Vue中,所谓的路由其实跟其他的框架中的路由的概念差不多,即指跳转的路径. 注意:在Vue中,要使用路由, ...

  6. 【AngularJs学习笔记五】AngularJS从构建项目开始

    为什么80%的码农都做不了架构师?>>>    #0 系列目录# AngularJs学习笔记 [AngularJs学习笔记一]Bower解决js的依赖管理 [AngularJs学习笔 ...

  7. ROS学习笔记五:理解ROS topics

    ROS学习笔记五:理解ROS topics 本节主要介绍ROS topics并且使用rostopic和rqt_plot命令行工具. 例子展示 roscore 首先运行roscore系列服务,这是使用R ...

  8. Spring Boot 框架学习笔记(五)( SpringSecurity安全框架 )

    Spring Boot 框架学习笔记(五) SpringSecurity安全框架 概述 作用 开发示例: 1. 新建项目 2. 引入依赖 3. 编写`SecurityConfig`类,实现认证,授权, ...

  9. Java学习笔记(五):一张图总结完JVM8基础概念

    Java学习笔记(五):一张图总结完JVM8基础概念 引文 最近在学习JVM的相关内容,好不容易把基础概念全部都学了一遍,却发现知识网络是零零散散的.迫不得已,只好再来一次总的归纳总结.为了更好的理解 ...

  10. Python学习笔记五:控制语句

    Python学习笔记五:控制语句 Pycharm 开发环境的下载安装配置_项目管理 控制语句 Pycharm 开发环境的使用 Pycharm 下载和安装 激活和选择不同UI 风格 创建项目和初始化配置 ...

最新文章

  1. Nginx——反向代理
  2. 吴恩达深度学习课程deeplearning.ai课程作业:Class 2 Week 1 3.Gradient Checking
  3. 使用USMT备份和还原用户数据
  4. java io效率_JAVA IO操作的总结 和速度实验
  5. 从零点五开始用Unity做半个2D战棋小游戏(八)
  6. 缓存-分布式锁-分布式锁原理与使用
  7. Pico Pro Maker Kit NXP i.MX7D刷入Android Things
  8. Swing中的一些对话框
  9. HDU 4651 数论 partition 求自然数的拆分数
  10. linux查询内核参数命令,Linux内核启动参数详解
  11. memchache的数据类型_memcache详解
  12. 最近发现一个爬虫开源项目weixin_crawler
  13. PyTorch: 各种图像格式相互转化
  14. 微信中html5获取手机号,微信小程序通过用户授权获取手机号
  15. 为什么专家都看好这本书
  16. [ZJOI2012]小蓝的好友
  17. 【《离散数学》试卷(A)】离散数学期末考试题——分享篇——题目完善、答案详尽【推荐学习】
  18. Python之判断闰年
  19. 小游戏开发 小程序app游戏开发 H5小游戏开发
  20. 券业零售业务转型方向已显现?从打造个人IP开始

热门文章

  1. [转]mysql的sql优化工具
  2. 使用js直接下载pdf文件而不用在新的浏览器窗口打开
  3. WiFi(Wireless Fidelity)基础(六)
  4. 【20保研】南京邮电大学关于举办2019 年江苏省研究生“大数据时代下的新型网络计算” 暑期学校的通知...
  5. 视频分析中的那点事情
  6. Oracle函数--日期函数
  7. sql 语句操作,修改字段中字符串的一部分
  8. java错误无法读取配置文件_解决Java Web项目无法读取配置文件问题
  9. 陆奇:一个完美主义者的退出
  10. foxmail无法绑定邮箱服务器地址,Foxmail 提示无法登陆pop3服务器,收不了邮件。...