{"id":240,"date":"2013-12-18T22:53:05","date_gmt":"2013-12-18T13:53:05","guid":{"rendered":"http:\/\/blog.ymyzk.com\/?p=240"},"modified":"2014-12-03T10:34:06","modified_gmt":"2014-12-03T01:34:06","slug":"raspbian-image-resize","status":"publish","type":"post","link":"https:\/\/blog.ymyzk.com\/2013\/12\/raspbian-image-resize\/","title":{"rendered":"Raspberry Pi \u306e\u30a4\u30e1\u30fc\u30b8\u30d5\u30a1\u30a4\u30eb\u3092\u62e1\u5f35\u3059\u308b"},"content":{"rendered":"

\"Raspberry<\/a><\/p>\n

Raspberry Pi\u3092QEMU\u3067\u30a8\u30df\u30e5\u30ec\u30fc\u30c8\u3059\u308b\u65b9\u6cd5<\/a>\u00a0\u3067\u306f, Raspbian \u3092 QEMU \u3067\u52d5\u4f5c\u3055\u305b\u308b\u65b9\u6cd5\u3092\u307e\u3068\u3081\u307e\u3057\u305f. \u3057\u304b\u3057, \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30a4\u30e1\u30fc\u30b8\u306e\u307e\u307e\u3067\u306f\u30a4\u30e1\u30fc\u30b8\u30d5\u30a1\u30a4\u30eb\u306e\u7a7a\u304d\u5bb9\u91cf\u304c\u6570\u767eMB\u3057\u304b\u306a\u3044\u305f\u3081, \u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u672c\u683c\u7684\u306b\u5229\u7528\u3059\u308b\u3053\u3068\u306f\u56f0\u96e3\u3067\u3059.\u00a0\u3053\u3053\u3067\u306f, Raspbian \u306e\u30a4\u30e1\u30fc\u30b8\u30d5\u30a1\u30a4\u30eb\u3092\u30ea\u30b5\u30a4\u30ba\u3059\u308b\u65b9\u6cd5\u3092\u307e\u3068\u3081\u307e\u3059.<\/p>\n

<\/p>\n

\u30a4\u30e1\u30fc\u30b8\u30d5\u30a1\u30a4\u30eb\u306e\u30ea\u30b5\u30a4\u30ba<\/h2>\n

\u3053\u306e\u4f5c\u696d\u306f\u30db\u30b9\u30c8\u5074\u3067\u884c\u3044\u307e\u3059. \u3053\u3053\u3067\u306f, 2013-09-25-wheezy-raspbian.img \u306e\u30a4\u30e1\u30fc\u30b8\u30d5\u30a1\u30a4\u30eb\u30921GB\u62e1\u5f35\u3057\u307e\u3059.<\/p>\n

\r\nqemu-img resize 2013-09-25-wheezy-raspbian.img +1GB\r\n<\/pre>\n

\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306e\u30ea\u30b5\u30a4\u30ba<\/h2>\n

\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306e\u30ea\u30b5\u30a4\u30ba\u3092\u884c\u3046\u305f\u3081, QEMU \u3067\u5148\u307b\u3069\u62e1\u5f35\u3057\u305f\u30a4\u30e1\u30fc\u30b8\u30d5\u30a1\u30a4\u30eb\u3092\u8d77\u52d5\u3057\u307e\u3059.<\/p>\n

Raspbian \u306b\u30ed\u30b0\u30a4\u30f3\u3057, fdisk \u3092\u4f7f\u3063\u3066\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u30c6\u30fc\u30d6\u30eb\u3092\u64cd\u4f5c\u3057\u307e\u3059.<\/p>\n

\r\npi@raspberrypi:~$ sudo fdisk \/dev\/sda\r\n<\/pre>\n

\u73fe\u5728\u306e\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u30c6\u30fc\u30d6\u30eb\u3092\u78ba\u8a8d\u3057\u307e\u3059.<\/p>\n

\r\nCommand (m for help): p\r\n\r\nDisk \/dev\/sda: 4035 MB, 4035969024 bytes\r\n125 heads, 62 sectors\/track, 1017 cylinders, total 7882752 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk identifier: 0x0002c262\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sda1            8192      122879       57344    c  W95 FAT32 (LBA)\r\n\/dev\/sda2          122880     5785599     2831360   83  Linux\r\n<\/pre>\n

\u3053\u3053\u3067\u306f \/dev\/sda2 \u3092\u62e1\u5f35\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081, \u4e00\u65e6\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f32\u3092\u524a\u9664\u3057\u307e\u3059.<\/p>\n

\r\nCommand (m for help): d\r\nPartition number (1-4): 2\r\n<\/pre>\n

\u6539\u3081\u3066\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f32\u3092\u4f5c\u6210\u3057\u307e\u3059. \u30d7\u30e9\u30a4\u30de\u30ea\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u3068\u3057\u3066\u4f5c\u6210\u3057, \u958b\u59cb\u30bb\u30af\u30bf\u306f2048\u3067\u306f\u306a\u304f, \u5148\u307b\u3069\u524a\u9664\u3057\u305f\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u306e\u958b\u59cb\u30bb\u30af\u30bf\u306e122880\u3092\u8a2d\u5b9a\u3057\u307e\u3059<\/strong>. \u7d42\u4e86\u30bb\u30af\u30bf\u306f\u6700\u5927\u5024\u3092\u8a2d\u5b9a\u3057\u307e\u3059.<\/p>\n

\r\nCommand (m for help): n\r\nPartition type:\r\n   p   primary (1 primary, 0 extended, 3 free)\r\n   e   extended\r\nSelect (default p): p\r\nPartition number (1-4, default 2): 2\r\nFirst sector (2048-7882751, default 2048): 122880\r\nLast sector, +sectors or +size{K,M,G} (122880-7882751, default 7882751): 7882751\r\n<\/pre>\n

\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u30c6\u30fc\u30d6\u30eb\u3092\u66f8\u304d\u8fbc\u3093\u3067, fdisk \u3092\u7d42\u4e86\u3057\u307e\u3059.<\/p>\n

\r\nCommand (m for help): w\r\nThe partition table has been altered!\r\n\r\nCalling ioctl() to re-read partition table.\r\n\r\nWARNING: Re-reading the partition table failed with error 16: Device or resource busy.\r\nThe kernel still uses the old table. The new table will be used at\r\nthe next reboot or after you run partprobe(8) or kpartx(8)\r\nSyncing disks.\r\n<\/pre>\n

\u518d\u8d77\u52d5\u3059\u308b\u307e\u3067\u65b0\u3057\u3044\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u30c6\u30fc\u30d6\u30eb\u304c\u5229\u7528\u3055\u308c\u306a\u3044\u3068\u306e\u8b66\u544a\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067, Raspbian \u3092\u518d\u8d77\u52d5\u3057\u307e\u3059.<\/p>\n

\r\npi@raspberrypi:~$ sudo reboot\r\n<\/pre>\n

\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306e\u30ea\u30b5\u30a4\u30ba<\/h2>\n

\u518d\u8d77\u52d5\u3055\u308c\u305f\u6bb5\u968e\u3067\u306f\u307e\u3060\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306e\u62e1\u5f35\u3092\u884c\u3063\u3066\u306a\u3044\u305f\u3081, \u7a7a\u304d\u5bb9\u91cf\u306f\u5897\u3048\u3066\u3044\u307e\u305b\u3093.<\/p>\n

\r\npi@raspberrypi:~$ df -h\r\nFilesystem      Size  Used Avail Use% Mounted on\r\nrootfs          2.7G  2.5G   59M  98% \/\r\n\/dev\/root       2.7G  2.5G   59M  98% \/\r\ndevtmpfs        125M     0  125M   0% \/dev\r\ntmpfs            25M  184K   25M   1% \/run\r\ntmpfs           5.0M     0  5.0M   0% \/run\/lock\r\ntmpfs            50M     0   50M   0% \/run\/shm\r\n<\/pre>\n

resize2fs \u3092\u4f7f\u3063\u3066, \u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306e\u30ea\u30b5\u30a4\u30ba\u3092\u884c\u3044\u307e\u3059.<\/p>\n

\r\npi@raspberrypi:~$ sudo resize2fs \/dev\/sda2\r\nresize2fs 1.42.5 (29-Jul-2012)\r\nFilesystem at \/dev\/sda2 is mounted on \/; on-line resizing required\r\nold_desc_blocks = 1, new_desc_blocks = 1\r\nThe filesystem on \/dev\/sda2 is now 969984 blocks long.\r\n<\/pre>\n

\u3053\u308c\u3067\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u306e\u30ea\u30b5\u30a4\u30ba\u304c\u5b8c\u4e86\u3057\u307e\u3057\u305f. QEMU \u4e0a\u306e Raspbian \u306b\u3082\u69d8\u3005\u306a\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3092\u5165\u308c\u3066\u30c6\u30b9\u30c8\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059.<\/p>\n

\r\npi@raspberrypi:~$ df -h\r\nFilesystem      Size  Used Avail Use% Mounted on\r\nrootfs          3.7G  2.5G  1.1G  72% \/\r\n\/dev\/root       3.7G  2.5G  1.1G  72% \/\r\ndevtmpfs        125M     0  125M   0% \/dev\r\ntmpfs            25M  184K   25M   1% \/run\r\ntmpfs           5.0M     0  5.0M   0% \/run\/lock\r\ntmpfs            50M     0   50M   0% \/run\/shm\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

Raspberry Pi\u3092QEMU\u3067\u30a8\u30df\u30e5\u30ec\u30fc\u30c8\u3059\u308b\u65b9\u6cd5\u00a0\u3067\u306f, Raspbian \u3092 QEMU \u3067\u52d5\u4f5c\u3055\u305b\u308b\u65b9\u6cd5\u3092\u307e\u3068\u3081\u307e\u3057\u305f. \u3057\u304b\u3057, \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30a4\u30e1\u30fc\u30b8\u306e\u307e\u307e\u3067\u306f\u30a4\u30e1\u30fc\u30b8\u30d5\u30a1\u30a4\u30eb\u306e\u7a7a\u304d\u5bb9\u91cf\u304c\u6570\u767eMB\u3057\u304b\u306a\u3044 […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[16,32,35,34],"_links":{"self":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/240"}],"collection":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/comments?post=240"}],"version-history":[{"count":14,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/240\/revisions"}],"predecessor-version":[{"id":250,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/240\/revisions\/250"}],"wp:attachment":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/media?parent=240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/categories?post=240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/tags?post=240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}