raspi-configでI2C等を有効にしていくと、空き容量が足りなくなってくるので容量を拡張する。
$ sudo fdisk /dev/mmcblk0
Command (m for help): p
Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes
4 heads, 16 sectors/track, 243200 cylinders, total 15564800 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 identifier: 0x0009bf4f
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 6399999 3138560 83 Linux
まず削除。
Command (m for help): d
Partition number (1-4): 2
それから作成
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2): 2
First sector (2048-15564799, default 2048): 122880
Last sector, +sectors or +size{K,M,G} (122880-15564799, default 15564799): 10240000
確認
Command (m for help): p
保存
Command (m for help): 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.
再起動して反映する。
$ sudo reboot
起動したら、
sudo resize2fs /dev/mmcblk0p2
確認すると空き容量が増えている。
$ df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 4.7G 3.0G 1.5G 68% /
udev 10M 0 10M 0% /dev
tmpfs 12M 216K 12M 2% /run
/dev/mmcblk0p2 4.7G 3.0G 1.5G 68% /
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 24M 0 24M 0% /run/shm
/dev/mmcblk0p1 56M 27M 30M 48% /boot