CentOS 6.5 64位,调整分区大小

调整硬盘分区大小

想增加root空间,减少home空间。

1.查看硬盘使用情况。

[root@npm ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   48G   45G   17M 100% /
tmpfs                         246M     0  246M   0% /dev/shm
/dev/sda1                     485M   33M  427M   8% /boot
/dev/mapper/VolGroup-lv_home   50G  180M   47G   1% /home

2.调整home分区大小

[[email protected] ~]# umount /home
[[email protected] ~]# e2fsck -f /dev/mapper/VolGroup-lv_home
e2fsck 1.41.12 (17-May-2010)
第一步: 检查inode,块,和大小
第二步: 检查目录结构
第3步: 检查目录连接性
Pass 4: Checking reference counts
第5步: 检查簇概要信息
/dev/mapper/VolGroup-lv_home: 11/3303104 files (0.0% non-contiguous), 253351/13207552 blocks
[[email protected] ~]# resize2fs -p /dev/mapper/VolGroup-lv_home 2G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/VolGroup-lv_home to 524288 (4k) blocks.
Begin pass 2 (max = 32768)
正在重定位块            XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 404)
正在扫描inode表          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/mapper/VolGroup-lv_home is now 524288 blocks long.

[[email protected] ~]# mount /home
[[email protected] ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   48G   45G   17M 100% /
tmpfs                         246M     0  246M   0% /dev/shm
/dev/sda1                     485M   33M  427M   8% /boot
/dev/mapper/VolGroup-lv_home  2.0G  152M  1.8G   8% /home

3.释放空间

[[email protected] ~]# lvreduce -L 2G /dev/mapper/VolGroup-lv_home
  WARNING: Reducing active and open logical volume to 2.00 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
  Reducing logical volume lv_home to 2.00 GiB
  Logical volume lv_home successfully resized
[[email protected] ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   48G   45G   16M 100% /
tmpfs                         246M     0  246M   0% /dev/shm
/dev/sda1                     485M   33M  427M   8% /boot
/dev/mapper/VolGroup-lv_home  2.0G  152M  1.8G   8% /home
[[email protected] ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               99.51 GiB
  PE Size               4.00 MiB
  Total PE              25474
  Alloc PE / Size       13088 / 51.12 GiB
  Free  PE / Size       12386 / 48.38 GiB
  VG UUID               ILLwIo-pQ0o-2Ayw-fYcP-QhcW-A1id-Sozp1f

4.增加空余空间到root

[[email protected] ~]#  lvextend -L +48.38G /dev/mapper/VolGroup-lv_root
  Rounding size to boundary between physical extents: 48.38 GiB
  Extending logical volume lv_root to 96.54 GiB
  Logical volume lv_root successfully resized
[[email protected] ~]# resize2fs -p /dev/mapper/VolGroup-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/VolGroup-lv_root is mounted on /; on-line resizing required
old desc_blocks = 4, new_desc_blocks = 7
Performing an on-line resize of /dev/mapper/VolGroup-lv_root to 25307136 (4k) blocks.
The filesystem on /dev/mapper/VolGroup-lv_root is now 25307136 blocks long.

[[email protected] ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root   96G   45G   46G  50% /
tmpfs                         246M     0  246M   0% /dev/shm
/dev/sda1                     485M   33M  427M   8% /boot
/dev/mapper/VolGroup-lv_home  2.0G  152M  1.8G   8% /home

转载至:http://my.oschina.net/shanhe/blog/296735
时间: 2024-10-18 08:29:24

CentOS 6.5 64位,调整分区大小的相关文章

阿里云服务器CentOS 5.7(64位)安装配置LAMP服务器(Apache+PHP5+MySQL)

阿里云服务器CentOS 5.7(64位)安装配置LAMP服务器(Apache+PHP5+MySQL) 转载自:http://elf8848.iteye.com/blog/1698351 一.快速安装Apache+PHP5+MySql ----------------------------------------------------- 补充:由于163的yum源上只有php5.1.6 mysql 5.0.95 版本较低,请直接看最后面的<八.卸载php5.1,mysql5.0 重新安装ph

Centos 6.5 64位双网卡绑定

1.环境描述      我的Vmware workstation 10 安装Centos 6.5 64位加上双口的Intel千兆网卡,通过ifconfig -a|grep eth命令看到eth2和eth3两张网卡. 2.双网卡绑定步骤: 2.1 修改/etc/sysconfig/network-scripts/ifcfg-eth2配置文档,修改后的内容如下:    DEVICE=eth2       ONBOOT=yes              #系统启动时自动启用该设备    BOOTPRO

centOS 6.5(64位)安裝fcitx輸入法

參考文章:http://blog.csdn.net/yang1982_0907/article/details/17100409 0. 用root账户登录系统 1. 卸载iBus yum remove ibus 2. 将RHEL 6.4的软件源更换为CentOS 6.4的软件源 参考博文:http://blog.csdn.net/yang1982_0907/article/details/17022983 3. 添加fcitx软件源 wget http://download.opensuse.o

CentOS 6.4 64位 源码编译hadoop 2.2.0

CentOS 6.4 64位 源码编译hadoop 2.2.0 搭建环境:Centos 6.4 64bit 1.安装JDK 参考这里2.安装mavenmaven官方下载地址,可以选择源码编码安装,这里就直接下载编译好的wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.zip解压文件后,同样在/etc/profie里配置环境变量vim /etc/profieexport

32位机与64位机数据大小

32位机与64位机数据大小 32位编译器: char :1个字节       char*(即指针变量): 4个字节(32位的寻址空间是2^32, 即32个bit,也就是4个字节.同理64位编译器) short int : 2个字节 int:  4个字节 unsigned int : 4个字节 float:  4个字节 double:   8个字节 long:   4个字节 long long:  8个字节 unsigned long:  4个字节 64位编译器: char :1个字节 char*

Centos 6.5 64位安装VPN

一.首先检查你VPS的PPP和TUN有没有启用: cat /dev/ppp  cat /dev/net/tun 显示结果为:cat: /dev/ppp: No such device or address和cat: /dev/net/tun: File descriptor in bad state,表明通过,上述两条只要有一个没通过都不行.如果没有启用,你可以给VPS提供商Submit 一个 Ticket请求开通: Hello Could you enabled TUN-TAP for me?

调整分区大小(ext2\ext3\ext4)

现在的时间是2017年5月27日 我想说调整分区大小没那么麻烦,至少我直接将一个ext3格式分区从50G减少到了30G. 步骤如下 1 首先确保那个分区是没被挂载的. 2 调整分区大小,但是其实并没有实际的改变分区的边界. e2fsck /dev/sda3 resize2fs /dev/sda3 30G 3 删了分区,重建分区.这样分区的大小就被改变了. 需要注意的是,你重建的分区必须和原来的分区起始地址一致,分区编号一致. 那你就事先打印一下,记住那个分区开始的扇区.(fdisk 的命令 p)

centos 6.5 64位下安装源码安装mysql 5.6.15

系统环境是centos 6.5 64位的 首先在防火墙里面增加3306端口: 然后保存:wq! 保存好后重启下防火墙 service iptables restart 安装系统所需要的依赖包 [[email protected] ~]# yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*  cmake  bison

centos 6.3 64位安装php5.5及配置tengine

PHP 用到的工具包: yum install gd-devel libjpeg-devel libpng-devel freetype-devel libxml2-devel curl-devel openssl-devel libicu-devel libmcrypt-devel PHP configure参数 ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql

CentOS 6.5 64位下安装Redis3.0.2的具体流程

系统环境:CentOS 6.5 64位 安装方式:编译安装 防火墙:开启 Redis版本:Redis 3.0.2 一.环境准备 1.安装 gcc gcc-c++ [[email protected] ~]# yum install gcc gcc-c++ -y 2.下载redis-3.0.2.tar.gz [[email protected] ~]# wget http://download.redis.io/releases/redis-3.0.2.tar.gz 二.安装Redis [[ema