Raspberry Piに使うSDカードの準備は前回でしたので,起動と容量の変更を行う.
容量の変更とは,初期では2GBまでしか使用しないようになっているので,
それを拡張してSDカードの容量いっぱいまで使用できるようにする.
起動は,SDカードを挿してから電源を挿す.
なお,電源ボタンはないのでシャットダウンすると電源を挿し直すしかない.
SDカードと電源を挿して起動すると,いろいろ出力されログイン画面に行く.
初期状態では,
ユーザ : root
パスワード : root
になっている.
これでログインが行える.
2Gから容量いっぱいに拡張するには,以下のコマンドを使用する.
入力を求められるところでpを入力してパーティションの確認を行う.
[root@alarmpi ~]# fdisk /dev/mmcblk0 Welcome to fdisk (util-linux 2.21.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): p //pを入力 Disk /dev/mmcblk0: 15.7 GB, 15720251392 bytes, 30703616 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 Disk label type: dos Disk identifier: 0x00057540 Device Boot Start End Blocks Id System /dev/mmcblk0p1 2048 186367 92160 c W95 FAT32 (LBA) /dev/mmcblk0p2 186368 3667967 1740800 5 Extended /dev/mmcblk0p5 188416 3667967 1739776 83 Linux
次にパーティションの削除を行う.
上記のコマンドで表示された2番目のパーティションを削除する
Command (m for help): d //dを入力 Partition number (1,2,5, default 5): 2 //2を入力 Partition 2 is deleted
パーティションの削除を行ったので,新しいパーティションの作成を行う.
パーティションのタイプは最初extendedを指定し,その中にlogicalを作成する.
Command (m for help): n //nを入力 Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): e //eを入力 Partition number (2-4, default 2): //デフォルトの2を入力するか何も入力しない First sector (186368-30703615, default 186368): //デフォルトの186368を入力するか何も入力しない Using default value 186368 Last sector, +sectors or +size{K,M,G} (186368-30703615, default 30703615): //デフォルトの30703615を入力するか何も入力しない Using default value 30703615 Partition 2 of type Extended and of size 14.6 GiB is set Command (m for help): n //nを入力 Partition type: p primary (1 primary, 1 extended, 2 free) l logical (numbered from 5) Select (default p): l //lを入力 Adding logical partition 5 First sector (188416-30703615, default 188416): //デフォルトの188416を入力するか何も入力しない Using default value 188416 Last sector, +sectors or +size{K,M,G} (188416-30703615, default 30703615): //デフォルトの30703615を入力するか何も入力しない Using default value 30703615 Partition 5 of type Linux and of size 14.6 GiB is set
最後にパーティション情報を書き込む
Command (m for help): w //wを入力 The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: 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) Syncing disks.
再起動を求められるのでreboot.
再起動後,下記のコマンドを実行する(かなり時間がかかる).
[root@alarmpi ~]# resize2fs /dev/mmcblk0p5 resize2fs 1.42.5 (29-Jul-2012) Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 1 Performing an on-line resize of /dev/mmcblk0p2 to 3883264 (4k) blocks. The filesystem on /dev/mmcblk0p2 is now 3883264 blocks long.
これで,容量を増やすことができる.
[ad#ad-1]
最近のコメント