新增 延展系統硬碟
67
%E5%BB%B6%E5%B1%95%E7%B3%BB%E7%B5%B1%E7%A1%AC%E7%A2%9F.md
Normal file
67
%E5%BB%B6%E5%B1%95%E7%B3%BB%E7%B5%B1%E7%A1%AC%E7%A2%9F.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# 1. 確認磁碟大小
|
||||
|
||||
```bash
|
||||
lsblk
|
||||
```
|
||||
|
||||
```bash
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
|
||||
sda 8:0 0 64G 0 disk
|
||||
├─sda1 8:1 0 1M 0 part
|
||||
├─sda2 8:2 0 2G 0 part /boot
|
||||
└─sda3 8:3 0 30G 0 part
|
||||
└─ubuntu--vg-ubuntu--lv 252:0 0 30G 0 lvm /
|
||||
sr0 11:0 1 1024M 0 rom
|
||||
```
|
||||
|
||||
# 2. 調整硬碟大小
|
||||
|
||||
```bash
|
||||
sudo fdisk /dev/sda
|
||||
```
|
||||
|
||||
```bash
|
||||
Command (m for help): p
|
||||
Device Start End Sectors Size Type
|
||||
/dev/sda1 2048 4095 2048 1M BIOS boot
|
||||
/dev/sda2 4096 4198399 4194304 2G Linux filesystem
|
||||
/dev/sda3 4198400 67108830 62910431 30G Linux filesystem
|
||||
|
||||
Command (m for help): d
|
||||
Partition number (1-3, default 3):
|
||||
Partition 3 has been deleted.
|
||||
|
||||
Command (m for help): n
|
||||
Partition number (3-128, default 3):
|
||||
First sector (3719168-46137310, default 3719168):
|
||||
Last sector, +/-sectors or +/-size{K,M,G,T,P} (3719168-46137310, default 46135295):
|
||||
Created a new partition 3 of type 'Linux filesystem' and of size 62 GiB.
|
||||
Partition #3 contains a LVM2_member signature.
|
||||
Do you want to remove the signature? [Y]es/[N]o: N
|
||||
|
||||
Command (m for help): p
|
||||
Device Start End Sectors Size Type
|
||||
/dev/sda1 2048 4095 2048 1M BIOS boot
|
||||
/dev/sda2 4096 4198399 4194304 2G Linux filesystem
|
||||
/dev/sda3 4198400 124217694 130019295 62G Linux filesystem
|
||||
|
||||
Command (m for help): w
|
||||
The partition table has been altered.
|
||||
Syncing disks.
|
||||
```
|
||||
|
||||
# 3. 調整 PV 大小
|
||||
|
||||
```bash
|
||||
sudo pvresize /dev/sda3
|
||||
```
|
||||
|
||||
# 4. 調整 LV 大小
|
||||
|
||||
```bash
|
||||
sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
|
||||
```
|
||||
|
||||
```bash
|
||||
sudo resize2fs /dev/ubuntu-vg/ubuntu-lv
|
||||
```
|
||||
Reference in New Issue
Block a user