欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

怎樣給centos系統(tǒng)擴(kuò)展磁盤分區(qū)的實(shí)現(xiàn)方法

 更新時(shí)間:2019年12月25日 10:31:50   作者:行思  
這篇文章主要介紹了怎樣給centos系統(tǒng)擴(kuò)展磁盤分區(qū)的實(shí)現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

問題/故障/場景/需求

eve-ng的虛擬機(jī)ova的硬盤只有38G,需要增加空間,在vmware直接擴(kuò)展硬盤后,重啟系統(tǒng),使用fdisk -l可以看到硬盤擴(kuò)大了,但文件系統(tǒng)并沒有擴(kuò)大,還需要將這些新增的空間擴(kuò)展分配到某個(gè)文件系統(tǒng)才行。下面記錄了整個(gè)擴(kuò)展過程

解決方法/步驟

在VM里擴(kuò)大磁盤到250G重啟系統(tǒng)后,查看當(dāng)前的文件系統(tǒng)的情況

root@eve-ng:~# df -h
Filesystem          Size Used Avail Use% Mounted on
udev             7.9G   0 7.9G  0% /dev
tmpfs             1.6G  19M 1.6G  2% /run
/dev/mapper/eve--ng--vg-root  38G  13G  23G 36% /
tmpfs             7.9G   0 7.9G  0% /dev/shm
tmpfs             5.0M   0 5.0M  0% /run/lock
tmpfs             7.9G   0 7.9G  0% /sys/fs/cgroup
/dev/sda1           472M  83M 365M 19% /boot

root@eve-ng:~# fdisk -l
...省略部分內(nèi)容
Disk /dev/sda: 250 GiB, 268435456000 bytes, 524288000 sectors  //可以看到已經(jīng)有250G了
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3e3ca055

Device   Boot  Start   End Sectors Size Id Type
/dev/sda1 *    2048  999423  997376 487M 83 Linux
/dev/sda2    1001470 83884031 82882562 39.5G 5 Extended
/dev/sda5    1001472 83884031 82882560 39.5G 8e Linux LVM

Disk /dev/mapper/eve--ng--vg-root: 38.6 GiB, 41406169088 bytes, 80871424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/eve--ng--vg-swap_1: 980 MiB, 1027604480 bytes, 2007040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

//下面執(zhí)行分區(qū)
root@eve-ng:~# fdisk /dev/sda

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): n
Partition type
  p  primary (1 primary, 1 extended, 2 free)
  l  logical (numbered from 5)
Select (default p): p
Partition number (3,4, default 3): 3
First sector (999424-524287999, default 999424): 83884032 //注意,這里是之前分配的最后一塊(sda5 end)加一(83884031+1)
Last sector, +sectors or +size{K,M,G,T,P} (83884032-524287999, default 524287999): //注意看這是不是最后一塊

Created a new partition 3 of type 'Linux' and of size 210 GiB.

Command (m for help): t
Partition number (1-3,5, default 5): 3 3
Partition type (type L to list all types): 8e

Changed type of partition 'Linux' to 'Linux LVM'.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

root@eve-ng:~# reboot

root@eve-ng:~# pvcreate /dev/sda3
 Physical volume "/dev/sda3" successfully created
root@eve-ng:~# vgdisplay
 --- Volume group ---
 VG Name        eve-ng-vg
 System ID
 Format        lvm2
 Metadata Areas    1
 Metadata Sequence No 3
 VG Access       read/write
 VG Status       resizable
 MAX LV        0
 Cur LV        2
 Open LV        2
 Max PV        0
 Cur PV        1
 Act PV        1
 VG Size        39.52 GiB
 PE Size        4.00 MiB
 Total PE       10117
 Alloc PE / Size    10117 / 39.52 GiB
 Free PE / Size    0 / 0
 VG UUID        EvwUbc-nfsg-dHqA-znxB-U3gv-V782-Q8ZxkI

root@eve-ng:~# vgextend eve-ng-vg /dev/sda3
 Volume group "eve-ng-vg" successfully extended
root@eve-ng:~# vgdisplay
 --- Volume group ---
 VG Name        eve-ng-vg
 System ID
 Format        lvm2
 Metadata Areas    2
 Metadata Sequence No 4
 VG Access       read/write
 VG Status       resizable
 MAX LV        0
 Cur LV        2
 Open LV        2
 Max PV        0
 Cur PV        2
 Act PV        2
 VG Size        249.52 GiB
 PE Size        4.00 MiB
 Total PE       63877
 Alloc PE / Size    10117 / 39.52 GiB
 Free PE / Size    53760 / 210.00 GiB
 VG UUID        EvwUbc-nfsg-dHqA-znxB-U3gv-V782-Q8ZxkI

root@eve-ng:~# lvdisplay
 --- Logical volume ---
 LV Path        /dev/eve-ng-vg/root
 LV Name        root
 VG Name        eve-ng-vg
 LV UUID        ktUpR0-VpqS-rJJv-a1FC-u6Gd-U8yN-2WYQ53
 LV Write Access    read/write
 LV Creation host, time eve-ng, 2018-03-21 02:25:21 +0200
 LV Status       available
 # open         1
 LV Size        38.56 GiB
 Current LE       9872
 Segments        1
 Allocation       inherit
 Read ahead sectors   auto
 - currently set to   256
 Block device      253:0

//擴(kuò)展邏輯卷
root@eve-ng:~# lvextend -l +100%FREE /dev/eve-ng-vg/root
 Size of logical volume eve-ng-vg/root changed from 38.56 GiB (9872 extents) to 248.56 GiB (63632 extents).
 Logical volume root successfully resized.

root@eve-ng:~# df -h
Filesystem          Size Used Avail Use% Mounted on
udev             7.9G   0 7.9G  0% /dev
tmpfs             1.6G  19M 1.6G  2% /run
/dev/mapper/eve--ng--vg-root  38G  13G  23G 36% /
tmpfs             7.9G   0 7.9G  0% /dev/shm
tmpfs             5.0M   0 5.0M  0% /run/lock
tmpfs             7.9G   0 7.9G  0% /sys/fs/cgroup
/dev/sda1           472M  83M 365M 19% /boot

//在線擴(kuò)容,要先查看當(dāng)前的文件系統(tǒng)的類型,可以通過cat /etc/fstab來查看
root@eve-ng:~# resize2fs /dev/eve-ng-vg/root
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/eve-ng-vg/root is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 16
The filesystem on /dev/eve-ng-vg/root is now 65159168 (4k) blocks long.

root@eve-ng:~# df -h
Filesystem          Size Used Avail Use% Mounted on
udev             7.9G   0 7.9G  0% /dev
tmpfs             1.6G  19M 1.6G  2% /run
/dev/mapper/eve--ng--vg-root 245G  13G 222G  6% /
tmpfs             7.9G   0 7.9G  0% /dev/shm
tmpfs             5.0M   0 5.0M  0% /run/lock
tmpfs             7.9G   0 7.9G  0% /sys/fs/cgroup
/dev/sda1           472M  83M 365M 19% /boot

參考

在線擴(kuò)容
使用 resize2fs或xfs_growfs 對(duì)掛載目錄在線擴(kuò)容

  • resize2fs 針對(duì)文件系統(tǒng)ext2 ext3 ext4
  • xfs_growfs 針對(duì)文件系統(tǒng)xfs

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • CentOS Apache配置詳解 文字說明

    CentOS Apache配置詳解 文字說明

    要想在linux上實(shí)現(xiàn)網(wǎng)頁服務(wù)器(www)需要Apache這個(gè)服務(wù)器軟件,不過Apache僅能提供最基本的靜態(tài)網(wǎng)站數(shù)據(jù)而已,想要實(shí)現(xiàn)動(dòng)態(tài)網(wǎng)站的話,最好還是要PHP與MySQL的支持,所以下面我們將會(huì)以LAMP(linux+Apache+MySQL+PHP)作為安裝與設(shè)置的介紹。
    2011-03-03
  • Linux利用keepalived實(shí)現(xiàn)lvs的高可用性的操作方法

    Linux利用keepalived實(shí)現(xiàn)lvs的高可用性的操作方法

    LVS是Linux Virtual Server的簡寫,意即Linux虛擬服務(wù)器,是一個(gè)虛擬的服務(wù)器集群系統(tǒng)。這篇文章主要介紹了Linux利用keepalived實(shí)現(xiàn)lvs的高可用性 ,需要的朋友可以參考下
    2018-09-09
  • 如何使用iostat查看linux硬盤IO性能

    如何使用iostat查看linux硬盤IO性能

    這篇文章主要介紹了如何使用iostat查看linux硬盤IO性能,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-05-05
  • 使用Putty遠(yuǎn)程(SSH)管理Linux VPS的圖文教程

    使用Putty遠(yuǎn)程(SSH)管理Linux VPS的圖文教程

    Putty是一個(gè)免費(fèi)的、Windows 32平臺(tái)下的telnet、rlogin和ssh客戶端,但是功能絲毫不遜色于商業(yè)的telnet類工具。
    2010-12-12
  • Linux之Centos8創(chuàng)建CA證書教程

    Linux之Centos8創(chuàng)建CA證書教程

    大家好,本篇文章主要講的是Linux之Centos8創(chuàng)建CA證書教程,感興趣的同學(xué)趕快來看一看吧,對(duì)你有幫助的話記得收藏一下,方便下次瀏覽
    2021-12-12
  • 解決Linux Tensorflow2.0安裝問題

    解決Linux Tensorflow2.0安裝問題

    這篇文章主要介紹了Linux Tensorflow2.0安裝問題及解決方法,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-05-05
  • Ubuntu 16.04源碼編譯安裝Apache 2.4.25教程

    Ubuntu 16.04源碼編譯安裝Apache 2.4.25教程

    這篇文章主要為大家詳細(xì)介紹了Ubuntu 16.04源碼編譯安裝Apache 2.4.25,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-01-01
  • Linux中一對(duì)多配置日志服務(wù)器的詳細(xì)步驟

    Linux中一對(duì)多配置日志服務(wù)器的詳細(xì)步驟

    這篇文章主要介紹了Linux中一對(duì)多配置日志服務(wù)器步驟教程,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2022-07-07
  • 本地Windows遠(yuǎn)程桌面連接阿里云Ubuntu 16.04服務(wù)器的操作方法

    本地Windows遠(yuǎn)程桌面連接阿里云Ubuntu 16.04服務(wù)器的操作方法

    這篇文章主要介紹了本地Windows遠(yuǎn)程桌面連接阿里云Ubuntu 16.04服務(wù)器的方法,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-02-02
  • Linux 查看遠(yuǎn)程服務(wù)器文件狀態(tài)的方法

    Linux 查看遠(yuǎn)程服務(wù)器文件狀態(tài)的方法

    今天小編就為大家分享一篇Linux 查看遠(yuǎn)程服務(wù)器文件狀態(tài)的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-07-07

最新評(píng)論