初始安装系统的时候,硬盘只给我50G,在PVE面板增加了450G,那么操作系统里面需要进行扩容操作:
一、基于parted
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
$ fdisk -lu /dev/sda Disk /dev/sda: 500 GiB, 536870912000 bytes, 1048576000 sectors Disk model: QEMU HARDDISK 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: 0x51185552 Device Boot Start End Sectors Size Id Type /dev/sda1 2048 100665343 100663296 48G 83 Linux /dev/sda2 100667390 104855551 4188162 2G f W95 Ext'd (LBA) /dev/sda5 100667392 104855551 4188160 2G 82 Linux swap / Solaris $ swapoff /dev/sda5 $ parted /dev/sda GNU Parted 3.6 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print free Model: QEMU QEMU HARDDISK (scsi) Disk /dev/sda: 537GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1024B 1049kB 1048kB Free Space 1 1049kB 51.5GB 51.5GB primary xfs 51.5GB 51.5GB 1048kB Free Space 2 51.5GB 53.7GB 2144MB extended lba 5 51.5GB 53.7GB 2144MB logical linux-swap(v1) swap 53.7GB 537GB 483GB Free Space (parted) rm 5 (parted) rm 2 (parted) print free Model: QEMU QEMU HARDDISK (scsi) Disk /dev/sda: 537GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1024B 1049kB 1048kB Free Space 1 1049kB 51.5GB 51.5GB primary xfs 51.5GB 537GB 485GB Free Space (parted) resizepart 1 537GB Warning: Partition /dev/sda1 is being used. Are you sure you want to continue? Yes/No? y (parted) print free Model: QEMU QEMU HARDDISK (scsi) Disk /dev/sda: 537GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1024B 1049kB 1048kB Free Space 1 1049kB 537GB 537GB primary xfs (parted) wq $ df -h Filesystem Size Used Avail Use% Mounted on udev 960M 0 960M 0% /dev tmpfs 198M 452K 197M 1% /run /dev/sda1 48G 2.2G 46G 5% / tmpfs 987M 0 987M 0% /dev/shm tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 987M 0 987M 0% /tmp tmpfs 1.0M 0 1.0M 0% /run/credentials/getty@tty1.service tmpfs 198M 4.0K 198M 1% /run/user/1000 $ xfs_growfs /dev/sda1 meta-data=/dev/sda1 isize=512 agcount=4, agsize=3145728 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=1 = reflink=1 bigtime=1 inobtcount=1 nrext64=1 = exchange=0 metadir=0 data = bsize=4096 blocks=12582912, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 = rgcount=0 rgsize=0 extents data blocks changed from 12582912 to 131071744 root@Gitea:~# df -h Filesystem Size Used Avail Use% Mounted on udev 960M 0 960M 0% /dev tmpfs 198M 452K 197M 1% /run /dev/sda1 500G 11G 490G 3% / tmpfs 987M 0 987M 0% /dev/shm tmpfs 1.0M 0 1.0M 0% /run/credentials/systemd-journald.service tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 987M 0 987M 0% /tmp tmpfs 1.0M 0 1.0M 0% /run/credentials/getty@tty1.service tmpfs 198M 4.0K 198M 1% /run/user/1000 |
二、基于fdisk
文 章 源 自 note.t4x.orgByrd's Blog-https://note.t4x.org/basic/pve-parted-disk/文 章 源 自 note.t4x.orgByrd's Blog-https://note.t4x.org/basic/pve-parted-disk/# 备份当前分区表
$ sfdisk -d /dev/sda > sda_backup.txt
# 使用 fdisk
$ fdisk /dev/sda文 章 源 自 note.t4x.orgByrd's Blog-https://note.t4x.org/basic/pve-parted-disk/d # 删除分区
5 # 删除交换分区
d # 删除分区
2 # 删除扩展分区
d # 删除分区
1 # 删除主分区文 章 源 自 note.t4x.orgByrd's Blog-https://note.t4x.org/basic/pve-parted-disk/n # 创建新主分区
p # 主分区
1 # 分区号1
# 起始扇区:直接回车(使用默认2048)
# 结束扇区:+536G文 章 源 自 note.t4x.orgByrd's Blog-https://note.t4x.org/basic/pve-parted-disk/n # 创建扩展分区
e # 扩展分区
2 # 分区号2
# 起始扇区:直接回车
# 结束扇区:直接回车(使用所有剩余空间)文 章 源 自 note.t4x.orgByrd's Blog-https://note.t4x.org/basic/pve-parted-disk/n # 创建逻辑分区
# 起始扇区:直接回车
# 结束扇区:直接回车文 章 源 自 note.t4x.orgByrd's Blog-https://note.t4x.org/basic/pve-parted-disk/t # 更改分区类型
5 # 选择分区5
82 # Linux swap文 章 源 自 note.t4x.orgByrd's Blog-https://note.t4x.org/basic/pve-parted-disk/w # 保存并退出 文 章 源 自 note.t4x.orgByrd's Blog-https://note.t4x.org/basic/pve-parted-disk/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!
