如何将/home下的磁盘空间移动到/下面?

操作:

1.查看磁盘空间情况

[root@compute home]# df -h

Filesystem            Size  Used AvAIl Use% Mounted on

/dev/mapper/vg_compute-lv_root

531G   48G  478G  10% /

tmpfs                  16G   88K   16G   1% /dev/shm

/dev/mapper/ddf1_4c5349202020202010000055000000004711471100001450p1

485M   38M  422M   9% /boot

2.卸载/home

umount /home/

3.查看逻辑卷组信息

[root@compute home]# vgs

VG

#PV #LV

#SN Attr   VSize   VFree

vg_compute

1   3   0 wz--n- 556.44g 712.00m

4.检查磁盘是否正常

e2fsck -f

/dev/vg_compute/lv_home

5.缩小/home磁盘大小

resize2fs /dev/vg_compute/lv_home

1024M

lvreduce -L 1024M /dev/vg_compute/lv_home

6.扩展/磁盘大小

lvextend -L + 489G /dev/vg_compute/lv_root

resize2fs /dev/vg_compute/lv_root

7.挂载/home

mount /home

8./home下的用户文件夹恢复

一、新建用户文件夹并修改所属权限

mkdir /home/shome

chown shome:shome /home/shome

二、将 /etc/skel 目录里所有的文件(隐藏文件) 复制到 用户的默认目录里即可解决问题.

cp /etc/skel/.bash* /home/shome/

在Centos中创建新用户,但不知道为什么在用户的默认目录文件夹里没有产生".bash_profile".

在切换到新用户的时候,会出现下面的问题,不会出现shell的名字

解决方法:

将 /etc/skel 目录里所有的文件(隐藏文件)

复制到 用户的默认目录里即可解决问题.

由于Openstack的Volume需要一块独立的分卷,所以我在分区的时候就直接创建了一个Volume作为vg。这里注意vg的名字一定要为"nova-vloumes",通过vgdisplay可以查看

附录:

一 pvs,lvs

vgs 使用

--1.1 显示物理卷(pv)信息

[root@redhat6 lvm]# pvs

PV         VG         Fmt

Attr PSize  PFree

/dev/sda2  vg_redhat6 lvm2 a--  14.51g    0

/dev/sdb

vg_redhat6 lvm2 a--   4.00g

2.81g

--1.2 显示逻辑卷组(vg)信息

[root@redhat6 lvm]# vgs

VG

#PV #LV

#SN Attr   VSize  VFree

vg_redhat6

2   3   0 wz--n- 18.50g 2.81g

--1.3显示逻辑卷(lv)信息

[root@redhat6 lvm]# lvs

LV           VG         Attr

LSize   Origin Snap%  Move Log Copy%  Convert

lv_pgdata_01 vg_redhat6 -wi-ao 700.00m

lv_root

vg_redhat6 -wi-ao  13.10g

lv_swap

vg_redhat6 -wi-ao   1.91g

备注:前面的 pvs,lvs,vgs 命令简单显示 LVM 对像信息,都是默认的输出。

二 格式化控制

--2.1 显示额外信息

[root@redhat6 lvm]# pvs -v

Scanning for

physical volume names

PV

VG         Fmt  Attr PSize

PFree DevSize PV UUID

/dev/sda2

vg_redhat6 lvm2 a--  14.51g    0   14.51g

dpTW84-DHRy-PIA9-u1tY-YUH4-XQKw-8Hy2Zm

/dev/sdb

vg_redhat6 lvm2 a--   4.00g

2.81g   4.00g

YKIQwX-zc6H-TZ65-P3qr-sRfk-LX0p-T18vdG

[root@redhat6 lvm]# vgs -v

Finding all volume groups

Finding volume group "vg_redhat6"

VG

Attr   Ext

#PV #LV

#SN VSize  VFree VG UUID

vg_redhat6 wz--n- 4.00m   2   3   0 18.50g 2.81g E6cA2U-TL1x-ScCV-UnGU-3Kq4-1u6V-WUb5L4

备注:增加 -v 参数,会显示LVM 对像的额外信息,例如 UUID字段。

--2.2 pvs 默认输出

[root@redhat6 lvm]# pvs

PV         VG         Fmt

Attr PSize  PFree

/dev/sda2  vg_redhat6 lvm2 a--  14.51g    0

/dev/sdb

vg_redhat6 lvm2 a--   4.00g

2.81g

--2.3 只显示 pv_name,dev_size 字段

[root@redhat6 lvm]# pvs -o pv_name,dev_size

PV         DevSize

/dev/sda2   14.51g

/dev/sdb     4.00g

备注:增加 -o 参数,指定需要输出的字段。

--2.4 在pvs 默认输出上,增加字段

[root@redhat6 lvm]# pvs

PV

VG         Fmt  Attr PSize

PFree

/dev/sda2

vg_redhat6 lvm2 a--  14.51g    0

/dev/sdb

vg_redhat6 lvm2 a--   4.00g

2.81g

[root@redhat6 lvm]# pvs -o +pv_uuid

PV

VG         Fmt  Attr PSize

PFree PV UUID

/dev/sda2

vg_redhat6 lvm2 a--  14.51g    0

dpTW84-DHRy-PIA9-u1tY-YUH4-XQKw-8Hy2Zm

/dev/sdb

vg_redhat6 lvm2 a--   4.00g

2.81g

YKIQwX-zc6H-TZ65-P3qr-sRfk-LX0p-T18vdG

备注:如果想在默认输出的前提下增加字段,可以使用 -o + 字段名。

--2.5 vgs 显示卷组成员

[root@redhat6 lvm]# vgs

VG

#PV #LV

#SN Attr   VSize  VFree

vg_redhat6

2   3   0 wz--n- 18.50g 2.81g

[root@redhat6 lvm]# vgs -o +lv_name

VG

#PV #LV #SN Attr   VSize

VFree LV

vg_redhat6

2   3   0 wz--n- 18.50g 2.81g

lv_root

vg_redhat6

2   3   0 wz--n- 18.50g 2.81g

lv_swap

vg_redhat6   2   3   0

wz--n- 18.50g 2.81g lv_pgdata_01

三 字段排序

--3.1 根据

lv_size 字段排序

[root@redhat6 lvm]# lvs

LV           VG         Attr

LSize   Origin Snap%  Move Log Copy%  Convert

lv_pgdata_01 vg_redhat6 -wi-ao 700.00m

lv_root

vg_redhat6 -wi-ao  13.10g

lv_swap

vg_redhat6 -wi-ao   1.91g

[root@redhat6 lvm]# lvs -O lv_size

LV           VG

Attr   LSize   Origin Snap%

Move Log Copy%  Convert

lv_pgdata_01 vg_redhat6 -wi-ao 700.00m

lv_swap

vg_redhat6 -wi-ao   1.91g

lv_root

vg_redhat6 -wi-ao  13.10g

备注:如果想根据输出字段排序,可以使用 -O 字段名 选项。

四附

lvs,vgs,pvs 字段

--4.1 lvs字段

---------------------

lv_all               - All fields in this section.

lv_uuid              - Unique identifier.

lv_name              - Name.  LVs created for internal use are enclosed in

brackets.

lv_path              - Full pathname for LV.

lv_attr              - Various attributes - see man

page.

lv_major             - Persistent major number or -1 if

not persistent.

lv_minor             - Persistent minor number or -1 if

not persistent.

lv_read_ahead        - Read ahead setting in current units.

lv_kernel_major      - Currently assigned major number or -1

if LV is not

active.

lv_kernel_minor      - Currently assigned minor number or -1

if LV is not

active.

lv_kernel_read_ahead - Currently-in-use

read ahead setting in current units.

lv_size              - Size of LV in current units.

seg_count            - Number of segments in LV.

origin               - For snapshots, the origin

device of this LV.

origin_size          - For snapshots, the size of the

origin device of this LV.

snap_percent         - For snapshots, the percentage full

if LV is

active.

copy_percent         - For mirrors and pvmove, current

percentage in-sync.

move_pv              - For pvmove, Source PV of

temporary LV

created by pvmove.

convert_lv           - For lvconvert, Name of temporary LV created by lvconvert.

lv_tags              - Tags, if any.

mirror_log           - For mirrors, the LV holding the synchronisation log.

modules              - Kernel device-mapper modules

required for this LV.

--4.2 pvs字段

pv_all               - All fields in this section.

pe_start             - Offset to the start of data on

the underlying device.

pv_size              - Size of PV in current units.

pv_free              - Total amount of unallocated

space in current units.

pv_used              - Total amount of allocated space

in current units.

pv_attr              - Various attributes - see man

page.

pv_pe_count          - Total number of Physical Extents.

pv_pe_alloc_count    - Total number of allocated Physical

Extents.

pv_tags              - Tags, if any.

pv_mda_count         - Number of metadata areas on this

device.

pv_mda_used_count    - Number of metadata areas in use on this

device.

--4.3 vgs字段

vg_all               - All fields in this section.

vg_fmt               - Type of metadata.

vg_uuid              - Unique identifier.

vg_name              - Name.

vg_attr              - Various attributes - see man

page.

vg_size              - Total size of VG in current

units.

vg_free              - Total amount of free space in

current units.

vg_sysid             - System ID indicating when and

where it was created.

vg_extent_size       - Size of Physical Extents in current

units.

vg_extent_count      - Total number of Physical Extents.

vg_free_count        - Total number of unallocated Physical

Extents.

max_lv               - Maximum number of LVs allowed

in VG or 0 if unlimited.

max_pv               - Maximum number of PVs allowed

in VG or 0 if unlimited.

pv_count             - Number of PVs.

lv_count             - Number of LVs.

snap_count           - Number of snapshots.

vg_seqno             - Revision number of internal

metadata.  Incremented whenever it

changes.

vg_tags              - Tags, if any.

vg_mda_count         - Number of metadata areas on this VG.

vg_mda_used_count    - Number of metadata areas in use on this

VG.

vg_mda_free          - Free metadata area space for this

VG in current units.

vg_mda_size          - Size of smallest metadata area for

this VG in current units.

vg_mda_copies        - Target number of in use metadata

areas in the VG.

linux 移动磁盘空间,如何将Linux下移动磁盘空间?相关推荐

  1. oracle删除表并释放空间,oracle删除(释放)数据文件/表空间流程

    1)批量将niptest表空间中的表move到USERS表空间,再删除表空间niptest首先看下此表空间内的表move到其他表空间防止数据丢失 select * from dba_tables wh ...

  2. Linux下的磁盘空间管理

    df -h /文件夹名 du -sh /文件夹名 后者统计的是我们能点开到的文件占用的空间,前者是总空间减去剩余空间. 可能出现的情况是二者不统一,原因见下: http://wushank.blog. ...

  3. linux下的磁盘空间使用

    有时候我们明明有很大磁盘空间,但是因为分配的原因,导致我们能过使用的空间很小,下面主要是关于使用磁盘空间的. 几个关于磁盘分区卷的命令: lsblk, fdisk -l df -h /dev目录下的设 ...

  4. linux下监控磁盘空间脚本

    Linux下监控磁盘的空闲空间的shell脚本,对于系统管理员或DBA来说,必不可少.下面是给出的一个监控磁盘空间空间shell脚本的样本. robin@SZDB:~/dba_scripts/cust ...

  5. Linux系统下提示磁盘空间满,但实际占用却很小

    Linux系统下提示磁盘空间满,但实际占用却很小 因为公司放在测试服务器上的服务比较多,磁盘经常性会满.以前满过几次,因为时间比较赶,每次只是草率的删掉一点log或者临时文件,到今天早上又发生一起事故 ...

  6. linux lvm添加磁盘,Linux下添加磁盘创建lvm分区

    shell> fdisk /dev/xvdb #### 选择磁盘 Command (m for help): m #### 帮助 Command action a toggle a bootab ...

  7. (原创)Linux下的磁盘碎片整理(2)

    作者:h2appy 转载请注明出处. 一.Linux下是否需要磁盘碎片整理 首先要说的是,我们下面要讨论的文件系统一定会产生磁盘碎片. 只是由于策略不同,产生的碎片多少不同而已.比如ext3通过预留空 ...

  8. linux的free会擦出磁盘吗,如何在 Linux 上检查可用的磁盘空间 | Linux 中国

    我已经使用了多少磁盘空间? (本文字数:2161,阅读时长大约:3 分钟) 在 Linux 上查找可用磁盘空间的最简单的方法是使用 df 命令 .df 命令从字面意思上代表着 磁盘可用空间(disk ...

  9. linux下的磁盘配额简介暨 linux下加挂硬盘续

    linux下的磁盘配额简介暨 linux下加挂硬盘续 实验环境 VMware 6.5.2 +redhat Enterprise 5 as 以上是内核版本,还有方便起见加挂一块硬盘 这只是我的环境 实验 ...

最新文章

  1. Vmware Tools安装之Ubuntu7.10问题解决--持续更新中
  2. Git使用教程-命令总结大全
  3. Android OkHttp完全解析
  4. HDU - 6746 Civilization(贪心+模拟)
  5. eclipse自动排版JSP问题
  6. 图像局部显著性—线特征
  7. 反射学习系列3-反射实例应用
  8. 普通程序员转型深度学习指南
  9. 作用 react_react-styleguidist核心知识点详解
  10. Python 数据科学入门教程:机器学习:回归
  11. php分享十三:mysql事物
  12. C#语言-NPOI.dll导入Excel功能的实现
  13. 程序员面对分歧和难题应当具备的态度
  14. Hiho1384 倍增+归并排序
  15. 利用DataEase的关联数据集制作宽表
  16. Tenorshare UltData(苹果数据恢复软件)v8.5.3官方版
  17. whatsns与tipask_tipask重大安安全漏洞之最佳答案bug修复
  18. 07.rpx布局与样式导入
  19. 辉芒微IO单片机FT60F211-RB
  20. ThinkPHP6使用七牛云存储,不改代码,改下配置就上七牛

热门文章

  1. 一文看懂 webpack 的所有 source map !
  2. 线程的故事(了解线程生命周期)
  3. 圣诞节!教你用 Python 画棵圣诞树
  4. App性能测试过程记录
  5. 豆瓣电影数据分析--Tableau
  6. 第3.1章:StarRocks数据导入--Insert into
  7. BUUCTF-WEB 【0CTF 2016】piapiapia 1
  8. 用 Python 对 Excel 表格内数据进行去重、分类,标记异常及分析
  9. 基于STM32F103系列单片机四路定时器电机编码器模式配置过程附源码
  10. 自动化测试工程师面试简历参考