ルートファイルシステム拡張
要再起動
ディスクイメージを調整して書き込んでいない場合、SDカードのサイズとファイルシステムのサイズが一致しない。
その為拡張処理が必要です。また拡張しないとディスク容量が不足するのでかなり制約となります。
「parted」と入力
[root@pidora ~]# parted
GNU Parted 3.1
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
「print」と入力し状態を確認
(parted) print
Model: SD USD (sd/mmc)
Disk /dev/mmcblk0: 31.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 53.5MB 52.4MB primary fat16 boot, lba
2 53.5MB 2168MB 2114MB primary ext4
「rm 2」と入力しrootパーテーションを一度削除
(parted) rm 2
Error: Partition(s) 2 on /dev/mmcblk0 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: SD USD (sd/mmc)
Disk /dev/mmcblk0: 31.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 53.5MB 52.4MB primary fat16 boot, lba
「rm 2」と入力しrootパーテーションを一度削除
確認が表示されるので「Ignore」と入力
(parted) rm 2
Error: Partition(s) 2 on /dev/mmcblk0 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: SD USD (sd/mmc)
Disk /dev/mmcblk0: 31.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 53.5MB 52.4MB primary fat16 boot, lba
「mkpart primary (Number 1のEnd位置) (SDカードサイズからスワップ分引いたEnd位置)」と入力しパーテーションを作成
スワップをパーテーションでは無くファイルの場合は最後まで
確認が表示されるので「Ignore」と入力
(parted) mkpart primary 53.5MB 31GB
Error: Partition(s) 2 on /dev/mmcblk0 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: SD USD (sd/mmc)
Disk /dev/mmcblk0: 31.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 53.5MB 52.4MB primary fat16 boot, lba
2 53.5MB 31.0GB 30.9GB primary ext4
「quit」と入力し終了
(parted) quit
Information: You may need to update /etc/fstab.
「reboot」と入力し一度再起動
[root@pidora ~]# reboot
「resize2fs /dev/mmcblk0p2」と入力しファイルシステムのリサイズ
[root@pidora ~]# resize2fs /dev/mmcblk0p2
resize2fs 1.42.8 (20-Jun-2013)
Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/mmcblk0p2 is now 7555328 blocks long.
「reboot」と入力し念のため再起動し完了
[root@pidora ~]# reboot