10Centos 7 新加硬盘

 

1.首先看是谁占用了大的空间

[root@netops ~]# cd /
[root@netops /]# du -sh *
0    bin
117M    boot
0    dev
36M    etc
12K    home
0    lib
0    lib64
0    media
0    mnt
0    opt
du: cannot access ‘proc/4086/task/4086/fd/4’: No such file or directory
du: cannot access ‘proc/4086/task/4086/fdinfo/4’: No such file or directory
du: cannot access ‘proc/4086/fd/4’: No such file or directory
du: cannot access ‘proc/4086/fdinfo/4’: No such file or directory
0    proc
40K    root
8.9M    run
0    sbin
0    srv
0    sys
0    tmp
1.7G    usr
29G    var
[root@netops /]# cd /var/
[root@netops var]# ls
adm  cache  crash  db  empty  games  gopher  kerberos  lib  local  lock  log  mail  nis  opt  preserve  run  spool  tmp  www  yp
[root@netops var]# du -sh *| grep G
29G    lib
[root@netops var]# cd lib/
[root@netops lib]# ls
alternatives  cs   dbus      games      logrotate  misc   net-snmp        os-prober  plymouth  postfix  rpm-state  stateless  tpm    vmware
authconfig    dav  dhclient  initramfs  machines   mysql  NetworkManager  php        polkit-1  rpm      rsyslog    systemd    tuned  yum
[root@netops lib]# du -sh *
28K    alternatives
0    authconfig
0    cs
0    dav
0    dbus
0    dhclient
0    games
0    initramfs
4.0K    logrotate
0    machines
0    misc
28G    mysql
4.0K    net-snmp
16K    NetworkManager
0    os-prober
4.0K    php
4.0K    plymouth
0    polkit-1
4.0K    postfix
77M    rpm
0    rpm-state
4.0K    rsyslog
0    stateless
64K    systemd
0    tpm
0    tuned
0    vmware
5.5M    yum
[root@netops lib]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   50G  0 disk 
├─sda1            8:1    0    2M  0 part 
├─sda2            8:2    0    1G  0 part /boot
└─sda3            8:3    0   40G  0 part 
  ├─centos-root 253:0    0   30G  0 lvm  /
  ├─centos-swap 253:1    0    2G  0 lvm  [SWAP]
  └─centos-home 253:2    0    5G  0 lvm  /home
sdb               8:16   0  300G  0 disk 
sr0              11:0    1 1024M  0 rom  
[root@netops lib]# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created.
[root@netops lib]# vgextend centos /dev/sdb
  Volume group "centos" successfully extended
[root@netops lib]# vgs
  VG     #PV #LV #SN Attr   VSize    VFree   
  centos   2   3   0 wz--n- <340.00g <303.00g
[root@netops lib]# lvextend -l +100%FREE -r /dev/centos/root 
  Size of logical volume centos/root changed from 30.00 GiB (7680 extents) to <333.00 GiB (85247 extents).
  Logical volume centos/root successfully resized.
meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=1966080 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=7864320, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=3840, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 7864320 to 87292928
[root@netops lib]# 
[root@netops lib]# 
[root@netops lib]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G  8.9M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root  333G   30G  303G  10% /
/dev/sda2               1014M  149M  866M  15% /boot
/dev/mapper/centos-home  5.0G   33M  5.0G   1% /home
tmpfs                    783M     0  783M   0% /run/user/0
[root@netops lib]# 
[root@netops lib]# 
[root@netops lib]# 
[root@netops lib]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   50G  0 disk 
├─sda1            8:1    0    2M  0 part 
├─sda2            8:2    0    1G  0 part /boot
└─sda3            8:3    0   40G  0 part 
  ├─centos-root 253:0    0  333G  0 lvm  /
  ├─centos-swap 253:1    0    2G  0 lvm  [SWAP]
  └─centos-home 253:2    0    5G  0 lvm  /home
sdb               8:16   0  300G  0 disk 
└─centos-root   253:0    0  333G  0 lvm  /
sr0              11:0    1 1024M  0 rom  
[root@netops lib]# df -h
Filesystem               Size  Used Avail Use% Mounted on
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G  8.9M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/centos-root  333G   30G  303G  10% /
/dev/sda2               1014M  149M  866M  15% /boot
/dev/mapper/centos-home  5.0G   33M  5.0G   1% /home
tmpfs                    783M     0  783M   0% /run/user/0

 

posted @ 2021-01-04 11:08  行者Sun  阅读(127)  评论(0编辑  收藏  举报