Raspberry PI 2 にインストールしたUbuntu MateにSDカードのすべての容量を認識させる
1.インストール
https://www.raspberrypi.org/downloads/
から、Ubuntu Mate をダウンロード、解凍(7zipが便利)して、image ファイルを、micro SD カードに焼く(Win32 Disk Imagerが便利)。Rasbperry Pi にさして起動。
2.SDカードの全容量を認識させる
https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=110785
32GB のSDカードを利用したのだが、7.2GB しか割り当てられていない。
- root@pi:/home/piroto# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/root 7.2G 3.9G 3.4G 54% /
- devtmpfs 459M 0 459M 0% /dev
- tmpfs 463M 404K 463M 1% /dev/shm
- tmpfs 463M 13M 451M 3% /run
- tmpfs 5.0M 4.0K 5.0M 1% /run/lock
- tmpfs 463M 0 463M 0% /sys/fs/cgroup
- /dev/mmcblk0p1 64M 20M 45M 32% /boot
- tmpfs 93M 44K 93M 1% /run/user/1000
http://raspberrypi.stackexchange.com/questions/37739/ubuntu-mate-not-using-all-its-storage
ルート(sudo su)もしくは sudo でFDISK を起動 (fdisk /dev/mmcblk0)
- root@pi:/dev# ls -l | grep "mmc*"
- brw-rw---- 1 root disk 179, 0 4月 21 2016 mmcblk0
- brw-rw---- 1 root disk 179, 1 4月 21 2016 mmcblk0p1
- brw-rw---- 1 root disk 179, 2 4月 21 2016 mmcblk0p2
- root@pi:/dev# fdisk /dev/mmcblk0
- Welcome to fdisk (util-linux 2.27.1).
- Changes will remain in memory only, until you decide to write them.
- Be careful before using the write command.
- Command (m for help): m
- Help:
- DOS (MBR)
- a toggle a bootable flag
- b edit nested BSD disklabel
- c toggle the dos compatibility flag
- Generic
- d delete a partition
- F list free unpartitioned space
- l list known partition types
- n add a new partition
- p print the partition table
- t change a partition type
- v verify the partition table
- i print information about a partition
- Misc
- m print this menu
- u change display/entry units
- x extra functionality (experts only)
- Script
- I load disk layout from sfdisk script file
- O dump disk layout to sfdisk script file
- Save & Exit
- w write table to disk and exit
- q quit without saving changes
- Create a new label
- g create a new empty GPT partition table
- G create a new empty SGI (IRIX) partition table
- o create a new empty DOS partition table
- s create a new empty Sun partition table
内容の確認(p)
- Command (m for help): p
- Disk /dev/mmcblk0: 29 GiB, 31117541376 bytes, 60776448 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: 0x580a66ff
- Device Boot Start End Sectors Size Id Type
- /dev/mmcblk0p1 * 2048 133119 131072 64M c W95 FAT32 (LBA)
- /dev/mmcblk0p2 133120 15728639 15595520 7.4G 83 Linux
削除から再作成(d – 2 – n – p – 2 – enter – enter – w) し、reboot
- Command (m for help): d
- Partition number (1,2, default 2): 2
- Partition 2 has been deleted.
- Command (m for help): 2
- 2: unknown command
- Command (m for help): n
- Partition type
- p primary (1 primary, 0 extended, 3 free)
- e extended (container for logical partitions)
- Select (default p): p
- Partition number (2-4, default 2): 2
- First sector (133120-60776447, default 133120):
- Last sector, +sectors or +size{K,M,G,T,P} (133120-60776447, default 60776447):
- Created a new partition 2 of type 'Linux' and of size 28.9 GiB.
- Command (m for help): w
- The partition table has been altered.
- Calling ioctl() to re-read partition table.
- Re-reading the partition table failed.: 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).
reboot あと、パーティションを拡張
- root@pi:/home/piroto# resize2fs /dev/mmcblk0p2
- resize2fs 1.42.13 (17-May-2015)
- 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 7580416 (4k) blocks long.
/ パーティションが、29GB と認識された。
- root@pi:/home/piroto# df -h
- Filesystem Size Used Avail Use% Mounted on
- /dev/root 29G 3.9G 25G 14% /
- devtmpfs 459M 0 459M 0% /dev
- tmpfs 463M 200K 463M 1% /dev/shm
- tmpfs 463M 6.8M 457M 2% /run
- tmpfs 5.0M 4.0K 5.0M 1% /run/lock
- tmpfs 463M 0 463M 0% /sys/fs/cgroup
- /dev/mmcblk0p1 64M 20M 45M 32% /boot
- tmpfs 93M 28K 93M 1% /run/user/1000