首頁 繪圖設計 工作閒聊 比賽活動 美術討論 標籤 圖片
利用 fdisk + resize2fs 增大/擴增 EXT3/EXT4 partition 大小
利用 fdisk + resize2fs 增大/擴增 EXT3/EXT4 partition 大小


Type(Type) 2018/10/30 19:30

利用 fdisk + resize2fs 增大/擴增 EXT3/EXT4 partition 大小



簡單說:先用 fdisk 刪除(d)再新增(n) partition,再用 resize2fs 把 EXT4 metadata 套用,這樣就完成。

代碼:

step-1. 假設有 /dev/sda1 & /dev/sda2,
sda2 後面還有空間 Free space,想增大 sda2 parition 大小

先備份! 先備份! Backup First!!

step-2. $ sudo su

step-3. $ umount /dev/sda2

step-4. $ e2fsck -f /dev/sda2

step-5. $ fdisk -l /dev/sda (記下 start & end sector)

step-6. $ fdisk /dev/sda
------------------------------------------
(6.1) "d" (delete) 刪除 /dev/sda2
(6.2) "n/p/2"「再」新增  /dev/sda2 ,Start Sector 請「保持相同 @ step-5」,End Sector 則增大 Capacity
(6.3) "w" (write) 寫入,離開
------------------------------------------

step-7. $ e2fsck -f /dev/sda2

step-8. $ resize2fs /dev/sda2

step-9. $ e2fsck -f /dev/sda2

step-10. $ mount /dev/sda2 <your mount-point>




擷取一段 resize2fs 的說明


The resize2fs program does not manipulate the size of partitions. If you wish to enlarge a filesystem, you must make sure you can expand the size of the underlying partition first. This can be done using fdisk(8) by deleting the partition and recreating it with a larger size or using lvextend(8), if you're using the logical volume manager lvm(8). When recreating the partition, make sure you create it with the same starting disk cylinder as before! Otherwise, the resize operation will certainly not work, and you may lose your entire file system. After running fdisk(8), run resize2fs to resize the ext2 file system to use all of the space in the newly enlarged partition.

(9,697 views)
[更多討論] 討論區 Windows, Linux, Perl, PHP, C/C++, Driver, Web 理論、應用、硬體、軟體

"利用 fdisk + resize2fs 增大/擴增 EXT3/EXT4 partition 大小" 傳統頁面(電腦版)

首頁 繪圖設計 工作閒聊 比賽活動 美術討論 標籤 圖片
傳統桌面版 [ 登入/註冊 ]
© Vovo2000.com Mobile Version 小哈手機版 2024