「パーティション」タグアーカイブ

Raspberry Pi 3 SDメモリの空きを認識させる。

Raspberry Pi 3にCentOSをインストールしたのですが、SDメモリの開いている容量が使えない状態にあります。

先の記事(「Raspberry Pi 3にCentOS 7を入れてみた時にやったこと」)でCentOSの設定を進めていることを前提としています。

SDメモリは32GBのものを準備しています。

それでは拡張設定を行います。

 

# parted /dev/mmcblk0
GNU Parted 3.1
/dev/mmcblk0 を使用
GNU Parted へようこそ! コマンド一覧を見るには 'help' と入力してください。
(parted) p
モデル: SD EB2MW (sd/mmc)
ディスク /dev/mmcblk0: 32.0GB
セクタサイズ (論理/物理): 512B/512B
パーティションテーブル: msdos
ディスクフラグ:

番号  開始    終了    サイズ  タイプ   ファイルシステム  フラグ
 1    1049kB  525MB   524MB   primary  fat16             lba
 2    525MB   1062MB  537MB   primary  linux-swap(v1)
 3     852MB  3000MB  2147MB  primary  ext4

(parted) rm 3                                                             
Error: Partition(s) 3 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? i                                                          
(parted) p                                                                
モデル: SD EB2MW (sd/mmc)
ディスク /dev/mmcblk0: 32.0GB
セクタサイズ (論理/物理): 512B/512B
パーティションテーブル: msdos
ディスクフラグ:

番号  開始    終了    サイズ  タイプ   ファイルシステム  フラグ
 1    1049kB  525MB   524MB   primary  fat16             lba
 2    525MB   1062MB  537MB   primary  linux-swap(v1)
(parted) mkpart primary 852M 32.0G                                             
Error: Partition(s) 3 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? i                                                          
(parted) p                                                                
モデル: SD EB2MW (sd/mmc)
ディスク /dev/mmcblk0: 32.0GB
セクタサイズ (論理/物理): 512B/512B
パーティションテーブル: msdos
ディスクフラグ:

番号  開始    終了    サイズ  タイプ   ファイルシステム  フラグ
 1    1049kB  525MB   524MB   primary  fat16             lba
 2    525MB   1062MB  537MB   primary  linux-swap(v1)
 3    1062MB  32.0GB  31.0GB  primary  ext4

(parted) quit                                                             
Information: You may need to update /etc/fstab.
#

こんな感じで、パーティションのサイズを拡張しました。
設定は完了したのですが、最後のメッセージにあります通りfstabを更新する必要があります。

面倒なので、rebootします。

# reboot

ログインし直して、df -hコマンドで確認してみてください。

# df -h
ファイルシス   サイズ  使用  残り 使用% マウント位置
/dev/root         29G  1.1G   27G    4% /
devtmpfs         459M     0  459M    0% /dev
tmpfs            463M     0  463M    0% /dev/shm
tmpfs            463M   12M  451M    3% /run
tmpfs            463M     0  463M    0% /sys/fs/cgroup
/dev/mmcblk0p1   500M   49M  452M   10% /boot
tmpfs             93M     0   93M    0% /run/user/0

/dev/rootのサイズが29Gになっています。
他でも使われているのでこんなもんで成功していると思ってよいでしょう。

ということで、パーティションの拡張は完了です。

Raspberry Pi 3の設定はまだ途中です。
次回は、yum updateが出来る様にしてみようと思います。

次回は、「Raspberry Pi 3 & CentOS 7でyum updateが出来る様に設定する!」です。