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 しか割り当てられていない。

  1. root@pi:/home/piroto# df -h
  2. Filesystem Size Used Avail Use% Mounted on
  3. /dev/root 7.2G 3.9G 3.4G 54% /
  4. devtmpfs 459M 0 459M 0% /dev
  5. tmpfs 463M 404K 463M 1% /dev/shm
  6. tmpfs 463M 13M 451M 3% /run
  7. tmpfs 5.0M 4.0K 5.0M 1% /run/lock
  8. tmpfs 463M 0 463M 0% /sys/fs/cgroup
  9. /dev/mmcblk0p1 64M 20M 45M 32% /boot
  10. 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)

  1. root@pi:/dev# ls -l | grep "mmc*"
  2. brw-rw---- 1 root disk 179, 0 4 21 2016 mmcblk0
  3. brw-rw---- 1 root disk 179, 1 4 21 2016 mmcblk0p1
  4. brw-rw---- 1 root disk 179, 2 4 21 2016 mmcblk0p2
  5. root@pi:/dev# fdisk /dev/mmcblk0
  6.  
  7. Welcome to fdisk (util-linux 2.27.1).
  8. Changes will remain in memory only, until you decide to write them.
  9. Be careful before using the write command.
  10.  
  11.  
  12. Command (m for help): m
  13.  
  14. Help:
  15.  
  16. DOS (MBR)
  17. a toggle a bootable flag
  18. b edit nested BSD disklabel
  19. c toggle the dos compatibility flag
  20.  
  21. Generic
  22. d delete a partition
  23. F list free unpartitioned space
  24. l list known partition types
  25. n add a new partition
  26. p print the partition table
  27. t change a partition type
  28. v verify the partition table
  29. i print information about a partition
  30.  
  31. Misc
  32. m print this menu
  33. u change display/entry units
  34. x extra functionality (experts only)
  35.  
  36. Script
  37. I load disk layout from sfdisk script file
  38. O dump disk layout to sfdisk script file
  39.  
  40. Save & Exit
  41. w write table to disk and exit
  42. q quit without saving changes
  43.  
  44. Create a new label
  45. g create a new empty GPT partition table
  46. G create a new empty SGI (IRIX) partition table
  47. o create a new empty DOS partition table
  48. s create a new empty Sun partition table

内容の確認(p)

  1. Command (m for help): p
  2. Disk /dev/mmcblk0: 29 GiB, 31117541376 bytes, 60776448 sectors
  3. Units: sectors of 1 * 512 = 512 bytes
  4. Sector size (logical/physical): 512 bytes / 512 bytes
  5. I/O size (minimum/optimal): 512 bytes / 512 bytes
  6. Disklabel type: dos
  7. Disk identifier: 0x580a66ff
  8.  
  9. Device Boot Start End Sectors Size Id Type
  10. /dev/mmcblk0p1 * 2048 133119 131072 64M c W95 FAT32 (LBA)
  11. /dev/mmcblk0p2 133120 15728639 15595520 7.4G 83 Linux

削除から再作成(d – 2 – n – p – 2 – enter – enter – w) し、reboot

  1. Command (m for help): d
  2. Partition number (1,2, default 2): 2
  3.  
  4. Partition 2 has been deleted.
  5.  
  6. Command (m for help): 2
  7. 2: unknown command
  8.  
  9. Command (m for help): n
  10. Partition type
  11. p primary (1 primary, 0 extended, 3 free)
  12. e extended (container for logical partitions)
  13. Select (default p): p
  14. Partition number (2-4, default 2): 2
  15. First sector (133120-60776447, default 133120):
  16. Last sector, +sectors or +size{K,M,G,T,P} (133120-60776447, default 60776447):
  17.  
  18. Created a new partition 2 of type 'Linux' and of size 28.9 GiB.
  19.  
  20. Command (m for help): w
  21. The partition table has been altered.
  22. Calling ioctl() to re-read partition table.
  23. Re-reading the partition table failed.: Device or resource busy
  24.  
  25. 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 あと、パーティションを拡張

  1. root@pi:/home/piroto# resize2fs /dev/mmcblk0p2
  2. resize2fs 1.42.13 (17-May-2015)
  3. Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required
  4. old_desc_blocks = 1, new_desc_blocks = 2
  5. The filesystem on /dev/mmcblk0p2 is now 7580416 (4k) blocks long.

/ パーティションが、29GB と認識された。

  1. root@pi:/home/piroto# df -h
  2. Filesystem Size Used Avail Use% Mounted on
  3. /dev/root 29G 3.9G 25G 14% /
  4. devtmpfs 459M 0 459M 0% /dev
  5. tmpfs 463M 200K 463M 1% /dev/shm
  6. tmpfs 463M 6.8M 457M 2% /run
  7. tmpfs 5.0M 4.0K 5.0M 1% /run/lock
  8. tmpfs 463M 0 463M 0% /sys/fs/cgroup
  9. /dev/mmcblk0p1 64M 20M 45M 32% /boot
  10. tmpfs 93M 28K 93M 1% /run/user/1000

Follow me!

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です