Advanced Options

擴充檔案系統

執行7 Advanced Options -> A1 Expand Filesystem 擴充Micro SD卡可使用的容量,一般狀況,如果在第一次開機時會自動延伸可用的sd空間,所以在第一次開機時都會比較久一點,如果第一次開機未完成,就有可能出現「Expand Filesystem」未執行成功,所以就會出現如下的內容,目前所使用32g的sd卡,但讀出來的結果卻怪怪的,那這個時後就要手動執行此功能讓系統空間能正常

第一次開機時未完成就強制關機

pi@raspberrypi:~ $ df -m
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/root          20421 19782         0 100% /
devtmpfs             460     0       460   0% /dev
tmpfs                464     0       464   0% /dev/shm
tmpfs                464    18       446   4% /run
tmpfs                  5     1         5   1% /run/lock
tmpfs                464     0       464   0% /sys/fs/cgroup
/dev/mmcblk0p1        41    21        21  51% /boot
tmpfs                 93     0        93   0% /run/user/1000

執行後的結果

pi@raspberrypi:~ $ df -m
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/root          29137  1098     26824   4% /
devtmpfs             460     0       460   0% /dev
tmpfs                464     0       464   0% /dev/shm
tmpfs                464    12       452   3% /run
tmpfs                  5     1         5   1% /run/lock
tmpfs                464     0       464   0% /sys/fs/cgroup
/dev/mmcblk0p1        41    21        21  51% /boot
tmpfs                 93     0        93   0% /run/user/1000

執行Expand Filesystem後,會出現如下圖的畫面,告知,Root partition has been resized,在下次重開機後檔案系統就會放大…

執行完如果沒有馬上重新開機,可以把畫面行上移就可以看到如下的執行過程

Welcome to fdisk (util-linux 2.29.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): Disk /dev/mmcblk0: 29 GiB, 31104958464 bytes, 60751872 sectors
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: 0xaf9d139f

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       8192    93236    85045 41.5M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      94208 60751871 60657664 28.9G 83 Linux

Command (m for help): Partition number (1,2, default 2):
Partition 2 has been deleted.

Command (m for help): Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): Partition number (2-4, default 2): First sector (2048-60751871, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (94208-60751871, default 60751871):
Created a new partition 2 of type 'Linux' and of size 28.9 GiB.
Partition #2 contains a ext4 signature.

Command (m for help):
Disk /dev/mmcblk0: 29 GiB, 31104958464 bytes, 60751872 sectors
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: 0xaf9d139f

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       8192    93236    85045 41.5M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      94208 60751871 60657664 28.9G 83 Linux

Command (m for help): The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy

The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).

Last updated

Was this helpful?