RaspberryPiの実験と話題 > いろいろな技集 > 8GBのSDイメージを16GBに展開した後、残りの8GBの領域を利用する
8GBのSDイメージを16GBに展開した後、残りの8GBの領域を利用する
fdiskで現在のパーティションの状態を確認します。
$ sudo fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.25.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
Disk /dev/mmcblk0: 14.6 GiB, 15648948224 bytes, 30564352 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: 0x00075de2
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 261718 253527 123.8M e W95 FAT16 (LBA)
/dev/mmcblk0p2 261719 15523839 15262121 7.3G 5 Extended
/dev/mmcblk0p5 262144 327677 65534 32M 83 Linux
/dev/mmcblk0p6 327680 456703 129024 63M c W95 FAT32 (LBA)
/dev/mmcblk0p7 458752 15523839 15065088 7.2G 83 Linux
Partition table entries are not in disk order.
Command (m for help):
@
コマンドを以下の順に入力して、未使用の領域に新しいパーティションを作ります。
- n
- p (primary)
- 3 (Partition no)
- 15523840 (15523839 + 1)
- <Enter>
- w (write and save)
警告が出るので再起動します。
再起動後、再度fdiskを開き、作成されていることを確認します。
$ sudo fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.25.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
Disk /dev/mmcblk0: 14.6 GiB, 15648948224 bytes, 30564352 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: 0x00075de2
Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 8192 261718 253527 123.8M e W95 FAT16 (LBA)
/dev/mmcblk0p2 261719 15523839 15262121 7.3G 5 Extended
/dev/mmcblk0p3 15523840 30564351 15040512 7.2G 83 Linux
/dev/mmcblk0p5 262144 327677 65534 32M 83 Linux
/dev/mmcblk0p6 327680 456703 129024 63M c W95 FAT32 (LBA)
/dev/mmcblk0p7 458752 15523839 15065088 7.2G 83 Linux
Partition table entries are not in disk order.
Command (m for help):
/dev/mmcblk0p3 ができていることを確認できましたので、以下のコマンドでファイルシステムをつくります。
$ sudo mkfs -t ext4 /dev/mmcblk0p3
$ sudo mkdir /ext
/etc/fstab に追加します。
proc /proc proc defaults 0 0
/dev/mmcblk0p6 /boot vfat defaults 0 2
/dev/mmcblk0p7 / ext4 defaults,noatime 0 1
/dev/mmcblk0p3 /ext ext4 defaults 0 0
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
再起動すれば完了です。
RaspberryPiの実験と話題 > いろいろな技集 > 8GBのSDイメージを16GBに展開した後、残りの8GBの領域を利用する