思绪的空中生活

pve调整磁盘大小
1.查看分割区的编号parted里面执行print(parted) print ...
扫描右侧二维码阅读全文
01
2020/12

pve调整磁盘大小

1.查看分割区的编号
parted里面执行print

(parted) print                                                            
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system     Flags
 1      1049kB  4295MB  4294MB  primary   ext4            boot
 2      4296MB  9999MB  5703MB  extended
 5      4296MB  5368MB  1072MB  logical   linux-swap(v1)

2.删除多余的分割区

(parted) rm 2                                                             
Warning: Partition /dev/sda2 is being used. Are you sure you want to continue?
Yes/No? yes                                                               
Error: Partition(s) 5 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result,
the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? Ignore                                                     
#再次查看分割区
(parted) print                                                            
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      1049kB  4295MB  4294MB  primary  ext4         boot

3.调整磁盘大小

(parted) resizepart                                                       
Partition number? 1                                                       
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
Yes/No? yes                                                               
End?  [4295MB]? 100%                                                      
Error: Error informing the kernel about modifications to partition /dev/sda1 -- 设备或资源忙.  This means Linux won't know about any changes you made to /dev/sda1 until you
reboot -- so you shouldn't mount it or use it in any way before rebooting.
Ignore/Cancel? Ignore                                                     
Error: Partition(s) 5 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result,
the old partition(s) will remain in use.  You should reboot now before making further changes.
Ignore/Cancel? Ignore

4.查看磁盘信息

root@:~# fdisk -l
Disk /dev/sda: 10 GiB, 10737418240 bytes, 20971520 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: 0xe0afa735

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1  *     2048 20971519 20969472  10G 83 Linux
#/dev/sda1 已经由5G变成10G了

5.重启服务器
reboot
6.resize2fs /dev/sda1

root@:~# resize2fs /dev/sda1
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/sda1 is now 2621184 (4k) blocks long.

7.df -h

root@:~# df -h
文件系统        容量  已用  可用 已用% 挂载点
udev            480M     0  480M    0% /dev
tmpfs            99M  2.9M   96M    3% /run
/dev/sda1       9.8G  1.4G  8.0G   15% /
tmpfs           494M     0  494M    0% /dev/shm
tmpfs           5.0M     0  5.0M    0% /run/lock
tmpfs           494M     0  494M    0% /sys/fs/cgroup
tmpfs            99M     0   99M    0% /run/user/0

相关文章:

  • 中兴f460开启telnet
  • 宝塔面板安装frp
  • N1将armbian刷入emmc
  • v2board前端 v2ray-poseidon后端 搭建
  • anyhk nat 食用指南
  • Last modification:December 1st, 2020 at 12:19 am
    If you think my article is useful to you, please feel free to appreciate

    Leave a Comment