Linux centos7 增加root分区容量

[root@192 /]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   50G  6.0G   44G  12% /
devtmpfs                 2.8G     0  2.8G   0% /dev
tmpfs                    2.8G     0  2.8G   0% /dev/shm
tmpfs                    2.8G  9.1M  2.8G   1% /run
tmpfs                    2.8G     0  2.8G   0% /sys/fs/cgroup
/dev/mapper/centos-home  967G   33M  967G   1% /home
/dev/sda1               1014M  180M  835M  18% /boot
tmpfs                    568M  4.0K  568M   1% /run/user/42
tmpfs                    568M   40K  568M   1% /run/user/0
[root@192 /]# clear























[root@192 /]# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
[root@192 /]# cp -r /home/ homebak
[root@192 /]# umount /home/
[root@192 /]# ls
bin  boot  dev  etc  home  homebak  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
[root@192 /]# lvremove /dev/mapper/centos-home
Do you really want to remove active logical volume centos/home? [y/n]: y
  Logical volume "home" successfully removed
[root@192 /]# lvextend -L +200G /dev/mapper/centos-root
  Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 250.00 GiB (64000 extents).
  Logical volume centos/root successfully resized.

[root@192 /]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=3276800 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=13107200, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=6400, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

data blocks changed from 13107200 to 65536000
[root@192 /]# 
[root@192 /]# df -lh 
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  250G  6.4G  244G   3% /
devtmpfs                 2.8G     0  2.8G   0% /dev
tmpfs                    2.8G     0  2.8G   0% /dev/shm
tmpfs                    2.8G  9.1M  2.8G   1% /run
tmpfs                    2.8G     0  2.8G   0% /sys/fs/cgroup
/dev/sda1               1014M  180M  835M  18% /boot
tmpfs                    568M  4.0K  568M   1% /run/user/42
tmpfs                    568M   56K  568M   1% /run/user/0
[root@192 /]# cd /root
[root@192 ~]# df -lh 
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  250G  6.4G  244G   3% /
devtmpfs                 2.8G     0  2.8G   0% /dev
tmpfs                    2.8G     0  2.8G   0% /dev/shm
tmpfs                    2.8G  9.1M  2.8G   1% /run
tmpfs                    2.8G     0  2.8G   0% /sys/fs/cgroup
/dev/sda1               1014M  180M  835M  18% /boot
tmpfs                    568M  4.0K  568M   1% /run/user/42
tmpfs                    568M   56K  568M   1% /run/user/0
[root@192 ~]# lvcreate -L 660G -n home centos
  Logical volume "home" created.
[root@192 ~]# mkfs.xfs /dev/centos/home
meta-data=/dev/centos/home       isize=512    agcount=4, agsize=43253760 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=173015040, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=84480, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@192 ~]# mount /dev/centos/home /home
[root@192 ~]# ls
anaconda-ks.cfg  Desktop  Documents  Downloads  initial-setup-ks.cfg  Music  Pictures  Public  Templates  Videos
[root@192 ~]# cd /
[root@192 /]# ls
bin  boot  dev  etc  home  homebak  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
[root@192 /]# cp -r /homebak/* /home
[root@192 /]# cd /home
[root@192 home]# ls
postgers
[root@192 home]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  250G  6.4G  244G   3% /
devtmpfs                 2.8G     0  2.8G   0% /dev
tmpfs                    2.8G     0  2.8G   0% /dev/shm
tmpfs                    2.8G  9.1M  2.8G   1% /run
tmpfs                    2.8G     0  2.8G   0% /sys/fs/cgroup
/dev/sda1               1014M  180M  835M  18% /boot
tmpfs                    568M  4.0K  568M   1% /run/user/42
tmpfs                    568M   52K  568M   1% /run/user/0
/dev/mapper/centos-home  660G   33M  660G   1% /home
[root@192 home]# 
上一篇:根据时间(秒数)获得两段时间的间隔


下一篇:PHP 时间转换 00:00:00格式