OS + Centos7.6 / CentOS-7-x86_64-Everything-1905-01.iso

shtml

 

https://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-Everything-1905-01.isonode

https://buildlogs.centos.org/rolling/7/isos/x86_64/CentOS-7-x86_64-Everything.isocentos

 

centOS7下安裝GUI圖形界面服務器

http://www.javashuo.com/article/p-hcfjtyiv-bd.html網絡

1、如何在centOS7下安裝GUI圖形界面

       當你安裝centOS7服務器版本的時候,系統默認是不會安裝GUI的圖形界面程序,這個須要手動安裝CentOS7 Gnome GUI包。app

2、在系統下使用命令安裝gnome圖形界面程序

       在安裝Gnome包以前,須要檢查一下安裝源(yum)是否正常,由於須要在yum命令來安裝gnome包。ui

       第一步:先檢查yum 是否安裝了,以及網絡是否有網絡。若是這二者都沒有,先解決網絡,在解決yum的安裝。spa

  (配置步驟能夠查看個人博客文章-centOS-配置網絡地址-的步驟來實現 )命令行

       第二步:在命令行下 輸入下面的命令來安裝Gnome包。code

       # yum groupinstall "GNOME Desktop" "Graphical Administration Tools"

       第三步:更新系統的運行級別。

       # ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target

       第四步:重啓機器。啓動默認進入圖形界面。

       # reboot

 

3、系統啓動後直接進入圖形界面

   

 

CentOS無損調整home,root磁盤的大小

http://www.javashuo.com/article/p-kuxgshbb-hk.html

調整硬盤分區大小
想增長root空間,減小home空間。

須要說明的是整個操做須要使用root用戶。

1.查看硬盤使用狀況。

[root@Slave1 /]# df -h
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/vg_slave6-lv_root   50G   22G   26G  46% /
tmpfs                          7.8G  160K  7.8G   1% /dev/shm
/dev/sda1                      485M   40M  420M   9% /boot
/dev/mapper/vg_slave6-lv_home  860G   25G  792G   4% /home

能夠看到home的大小是860G,而root的大小隻有50G。

個人目標是將home的大小縮小爲200G,其他的加到root中

接下來好戲上演了:

2.卸載/home

[root@Slave1 /]# umount /home
umount: /home: device is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

出現這種狀況表示有應用程序正在佔用home,強制清除掉就能夠,使用下邊的命令

[root@Slave1 /]# fuser -km /home

強制清除後在進行卸載

[root@Slave1 /]# umount /home

三、調整分區大小

複製代碼
[root@Slave1 /]# e2fsck -f /dev/mapper/vg_slave6-lv_home
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg_slave6-lv_home: 255/57229312 files (1.2% non-contiguous), 10040281/228912128 blocks
複製代碼

設置home的大小爲200G

複製代碼
[root@Slave1 /]# resize2fs -p /dev/mapper/vg_slave6-lv_home 200G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/vg_slave6-lv_home to 52428800 (4k) blocks.
Begin pass 2 (max = 32992)
Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 6986)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 123)
Updating inode references     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/mapper/vg_slave6-lv_home is now 52428800 blocks long.
複製代碼

掛載home

複製代碼
[root@Slave1 /]# mount /home
[root@Slave1 /]# df -h
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/vg_slave6-lv_root   50G   22G   26G  46% /
tmpfs                          7.8G  232K  7.8G   1% /dev/shm
/dev/sda1                      485M   40M  420M   9% /boot
/dev/mapper/vg_slave6-lv_home  197G   25G  163G  14% /home
複製代碼

能夠看到home的磁盤大小已經減少到了197G,剩餘3G的空間應該是被用掉了

4.釋放空間

[root@Slave1 /]# lvreduce -L 200G /dev/mapper/vg_slave6-lv_home
  WARNING: Reducing active and open logical volume to 200.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 200.00 GiB
  Logical volume lv_home successfully resized
複製代碼
[root@Slave1 /]# vgdisplay
  --- Volume group ---
  VG Name               vg_slave6
  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               931.02 GiB
  PE Size               4.00 MiB
  Total PE              238341
  Alloc PE / Size       65994 / 257.79 GiB
  Free  PE / Size       172347 / 673.23 GiB
  VG UUID               g1cRWV-O788-QKCc-lQG0-JaEp-s2BB-xNHxF3
複製代碼

會看到有637.23G的剩餘空間,接下來要作的就是把這些空間加載到root中

5.增長空餘空間到root

[root@Slave1 /]# lvextend -L +673.23G /dev/mapper/vg_slave6-lv_root
  Rounding size to boundary between physical extents: 673.23 GiB
  Extending logical volume lv_root to 723.23 GiB
  Logical volume lv_root successfully resized

接下來這個操做可能須要時間長點,加載的空間越大時間越長。

複製代碼
root@Slave1 /]# lvextend -L +673.23G /dev/mapper/vg_slave6-lv_root
  Rounding size to boundary between physical extents: 673.23 GiB
  Extending logical volume lv_root to 723.23 GiB
  Logical volume lv_root successfully resized
[root@Slave1 /]# resize2fs -p /dev/mapper/vg_slave6-lv_root
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/mapper/vg_slave6-lv_root is mounted on /; on-line resizing required
old desc_blocks = 4, new_desc_blocks = 46
Performing an on-line resize of /dev/mapper/vg_slave6-lv_root to 189590528 (4k) blocks.
The filesystem on /dev/mapper/vg_slave6-lv_root is now 189590528 blocks long.
複製代碼

查看一下

[root@Slave1 /]# df -h
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/vg_slave6-lv_root  712G   22G  655G   4% /
tmpfs                          7.8G  232K  7.8G   1% /dev/shm
/dev/sda1                      485M   40M  420M   9% /boot
/dev/mapper/vg_slave6-lv_home  197G   25G  163G  14% /home

大功告成,home,root中的內容沒有丟失

 

end

相關文章
相關標籤/搜索