|
如何将/home下的磁盘空间移动到/下面?
操作:
1.查看磁盘空间情况
[root@compute home]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_compute-lv_root
tmpfs
/dev/mapper/ddf1_
2.卸载/home
umount /home/
3.查看逻辑卷组信息
[root@compute home]# vgs
VG
#PV #
vg_compute
1 3 0 wz--n-
4.检查磁盘是否正常
e2fsck -f
/dev/vg_compute/lv_home
5.缩小/home磁盘大小
resize2fs /dev/vg_compute/lv_home
lvreduce -L
6.扩展/磁盘大小
lvextend -L +
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 lvm
/dev/sdb
vg_redhat6 lvm
--1.2 显示逻辑卷组(vg)信息
[root@redhat6 lvm]# vgs
VG
#PV #
vg_redhat6
2 3 0 wz--n-
--1.3显示逻辑卷(lv)信息
[root@redhat6 lvm]# lvs
lv_pgdata_01 vg_redhat6 -wi-ao
lv_root
vg_redhat6 -wi-ao
lv_swap
vg_redhat6 -wi-ao
备注:前面的 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 lvm
/dev/sdb
vg_redhat6 lvm
[root@redhat6 lvm]# vgs -v
Finding all volume groups
Finding volume group "vg_redhat6"
VG
Attr Ext
#PV #
vg_redhat6 wz--n-
备注:增加 -v 参数,会显示LVM 对像的额外信息,例如 UUID字段。
--2.2 pvs 默认输出
[root@redhat6 lvm]# pvs
PV VG Fmt
Attr PSize PFree
/dev/sda2 vg_redhat6 lvm
/dev/sdb
vg_redhat6 lvm
--2.3 只显示 pv_name,dev_size 字段
[root@redhat6 lvm]# pvs -o pv_name,dev_size
PV DevSize
/dev/sda2
/dev/sdb
备注:增加 -o 参数,指定需要输出的字段。
--2.4 在pvs 默认输出上,增加字段
[root@redhat6 lvm]# pvs
PV
VG Fmt Attr PSize
PFree
/dev/sda2
vg_redhat6 lvm
/dev/sdb
vg_redhat6 lvm
[root@redhat6 lvm]# pvs -o +pv_uuid
PV
VG Fmt Attr PSize
PFree PV UUID
/dev/sda2
vg_redhat6 lvm
/dev/sdb
vg_redhat6 lvm
备注:如果想在默认输出的前提下增加字段,可以使用 -o + 字段名。
--2.5 vgs 显示卷组成员
[root@redhat6 lvm]# vgs
VG
#PV #
vg_redhat6
2 3 0 wz--n-
[root@redhat6 lvm]# vgs -o +lv_name
VG
#PV #
vg_redhat6
2 3 0 wz--n-
vg_redhat6
2 3 0 wz--n-
vg_redhat6 2 3 0
wz--n-
三 字段排序
--3.1 根据
lv_size 字段排序
[root@redhat6 lvm]# lvs
lv_pgdata_01 vg_redhat6 -wi-ao
lv_root
vg_redhat6 -wi-ao
lv_swap
vg_redhat6 -wi-ao
[root@redhat6 lvm]# lvs -O lv_size
lv_pgdata_01 vg_redhat6 -wi-ao
lv_swap
vg_redhat6 -wi-ao
lv_root
vg_redhat6 -wi-ao
备注:如果想根据输出字段排序,可以使用 -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_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_kernel_minor - Currently assigned minor number or -1
if
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
origin - For snapshots, the origin
device of this
origin_size - For snapshots, the size of the
origin device of this
snap_percent - For snapshots, the percentage full
if
copy_percent - For mirrors and pvmove, current
percentage in-sync.
move_pv - For pvmove, Source PV of
temporary
convert_lv - For lvconvert, Name of temporary
lv_tags - Tags, if any.
mirror_log - For mirrors, the
modules - Kernel device-mapper modules
required for this
--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.
原文来自凌阳嵌入式培训 网,推荐阅读:http://emb.sunplusedu.com/answer/2013/0820/2112.html