快速业务通道

lvm及磁盘配额

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-05-17
0 0
/dev/newvg/home /home ext3 defaults,usrquota,grpquota 0 1
~
~
~
:wq
保持权限复制/home 下的文件到 新的分区
[root@localhost ~]# cp -a /home/* /mnt/
删除/home 下所有文件
[root@localhost mnt]# rm -rf /home/*
重新挂载
[root@localhost home]# umount /mnt/
[root@localhost home]# mount /dev/newvg/home /home/
重新挂载开启磁盘配额
[root@localhost home]# mount -o uerquota,grpquota,remount /dev/newvg/home 拥有帝国一切,皆有可能。欢迎访问phome.net
mount: /home not mounted already, or bad option
开启磁盘配额
[root@localhost home]#mount –o usrquota,grpquota /dev/newvg/home
重新生成配额文件
[root@localhost home]# quotacheck -cuvg /home
quotacheck: Scanning /dev/mapper/newvg-home [/home] quotacheck: Cannot stat old group quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
done
quotacheck: Checked 4 directories and 6 files
quotacheck: Old file not found.
[root@localhost home]# ls -l
total 36
-rw------- 1 root root 7168 Feb 21 02:02 aquota.group
-rw------- 1 root root 7168 Feb 21 02:02 aquota.user
drwx------ 2 root root 16384 Feb 21 01:28 lost found
drwx------ 2 redhat redhat 4096 Aug 17 2008 redhat
创建用户并设置密码
[root@localhost home]# useradd yueyang
[root@localhost home]# passwd yueyang
Changing password for user yueyang.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
设置对用户yueyang的配额
[root@localhost home]# edquota -u yueyang
Disk quotas for user yueyang (uid 501):
Filesystem blocks soft hard inodes soft hard
/dev/mapper/newvg-home 0 4000000 5000000 0 40000 50000
~
~
~
~
~:wq
将第二块磁盘转化为pv
[root@localhost home]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created
将新硬盘添加到newvg这个vg里
[root@localhost home]# vgextend newvg /dev/sdc
Volume group "newvg" successfully extended
添加/home逻辑卷的大小
[root@localhost home]# lvextend -L 10g /dev/newvg/home
Extending logical volume home to 29.00 GB
Logical volume home successfully resized
在线更新逻辑卷大小 拥有帝国一切,皆有可能。欢迎访问phome.net
[root@localhost home]# resize2fs /dev/newvg/home
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/newvg/home is mounted /home; -line resizing required
Performing an -line resize of /dev/newvg/home to 7602176 (4k) blocks.
The filesystem /dev/newvg/home is now 7602176 blocks long.

查看
[root@localhost home]# df -h /home/
Filesystem Size Used Avail Use% Mounted
/dev/mapper/newvg-home
29G 173M 27G 1% /home
分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号