日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

虚拟机磁盘扩容parted

發布時間:2024/8/26 编程问答 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 虚拟机磁盘扩容parted 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1、虛擬化平臺虛擬機添加硬盤

系統查看添加的硬盤

1

2

3

4

5

6

7

8

[root@yumserver?~]#?lsblk

NAME????????????MAJ:MIN?RM??SIZE?RO?TYPE?MOUNTPOINT

sda???????????????8:0????0???50G??0?disk?

├─sda1????????????8:1????0????1G??0?part?/boot

└─sda2????????????8:2????0???49G??0?part?

??├─centos-root?253:0????0???44G??0?lvm??/

??└─centos-swap?253:1????0????5G??0?lvm??[SWAP]

sr0??????????????11:0????1??4.4G??0?rom

如果沒有顯示出來新加的硬盤,則執行下面命令

1

2

3

?echo?"-?-?-">/sys/class/scsi_host/host0/scan

?echo?"-?-?-"?>/sys/class/scsi_host/host1/scan

?echo?"-?-?-"?>/sys/class/scsi_host/host2/scan

再次查詢,發現新添加的sdb已經可以看到了。

1

2

3

4

5

6

7

8

9

[root@yumserver?~]#?lsblk

NAME????????????MAJ:MIN?RM??SIZE?RO?TYPE?MOUNTPOINT

sda???????????????8:0????0???50G??0?disk?

├─sda1????????????8:1????0????1G??0?part?/boot

└─sda2????????????8:2????0???49G??0?part?

??├─centos-root?253:0????0???44G??0?lvm??/

??└─centos-swap?253:1????0????5G??0?lvm??[SWAP]

sdb???????????????8:16???0???50G??0?disk?

sr0??????????????11:0????1??4.4G??0?rom

2、parted將sdb分區

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

[root@yumserver?~]#?parted?/dev/sdb

GNU?Parted?3.1

使用?/dev/sdb

Welcome?to?GNU?Parted!?Type?'help'?to?view?a?list?of?commands.

(parted)?mklabel?gpt??????????????????????????????????????????????????????

(parted)?mkpart?primary?0%?100%???????????????????????????????????????????

(parted)?p????????????????????????????????????????????????????????????????

Model:?VMware?Virtual?disk?(scsi)

Disk?/dev/sdb:?53.7GB

Sector?size?(logical/physical):?512B/512B

Partition?Table:?gpt

Disk?Flags:?

Number??Start???End?????Size????File?system??Name?????標志

?1??????1049kB??53.7GB??53.7GB???????????????primary

(parted)?q????????????????????????????????????????????????????????????????

信息:?You?may?need?to?update?/etc/fstab.

[root@yumserver?~]#

再次查看,發現主分區sdb1出現了

1

2

3

4

5

6

7

8

9

10

11

[root@yumserver?~]#?lsblk?????????????????????????????????????????????????

NAME????????????MAJ:MIN?RM??SIZE?RO?TYPE?MOUNTPOINT

sda???????????????8:0????0???50G??0?disk?

├─sda1????????????8:1????0??500M??0?part?/boot

└─sda2????????????8:2????0?49.5G??0?part?

??├─centos-root?253:0????0?47.5G??0?lvm??/

??└─centos-swap?253:1????0????2G??0?lvm??[SWAP]

sdb???????????????8:16???0???50G??0?disk?

└─sdb1????????????8:17???0???50G??0?part?

sr0??????????????11:0????1?1024M??0?rom??

[root@yumserver?~]#

3?、查看現有vg,lv,確定擴容

1

2

3

4

5

6

7

8

9

10

11

[root@yumserver?~]#?pvs

??PV?????????VG?????Fmt??Attr?PSize???PFree

??/dev/sda2??centos?lvm2?a--??<49.51g????0?

[root@yumserver?~]#?vgs

??VG?????#PV?#LV?#SN?Attr???VSize???VFree

??centos???1???2???0?wz--n-?<49.51g????0?

[root@yumserver?~]#?lvs

??LV???VG?????Attr???????LSize???Pool?Origin?Data%??Meta%??Move?Log?Cpy%Sync?Convert

??root?centos?-wi-ao----?<47.51g????????????????????????????????????????????????????

??swap?centos?-wi-ao----???2.00g????????????????????????????????????????????????????

[root@yumserver?~]#

3?、分別創建pv,擴容vg,擴容lv,擴容文件系統

##此處發現不能tab補全命令,?yum install -y bash-completion

1

2

[root@yumserver?~]#?pvcreate?/dev/sdb1

??Physical?volume?"/dev/sdb1"?successfully?created.

1

2

[root@yumserver?~]#?vgextend?centos?/dev/sdb1

??Volume?group?"centos"?successfully?extended

1

2

3

[root@yumserver?~]#?lvextend?/dev/centos/root?-l?+100%FREE

??Size?of?logical?volume?centos/root?changed?from?<47.51?GiB?(12162?extents)?to?97.50?GiB?(24961?extents).

??Logical?volume?centos/root?successfully?resized.

此處為xfs

1

[root@yumserver?~]#?xfs_growfs?/dev/centos/root

再次查看,/目錄擴容成功

1

2

3

4

5

6

7

8

9

[root@yumserver?~]#?df?-h

文件系統?????????????????容量??已用??可用?已用%?掛載點

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???98G??1.4G???97G????2%?/

/dev/sda1????????????????497M??143M??354M???29%?/boot

tmpfs????????????????????783M?????0??783M????0%?/run/user/0

如果覺得對你有用,給點個贊吧.

與50位技術專家面對面20年技術見證,附贈技術全景圖

總結

以上是生活随笔為你收集整理的虚拟机磁盘扩容parted的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。