{"id":6457,"date":"2023-07-13T13:26:29","date_gmt":"2023-07-13T05:26:29","guid":{"rendered":"https:\/\/blog.hoyo.idv.tw\/?p=6457"},"modified":"2023-07-13T13:26:43","modified_gmt":"2023-07-13T05:26:43","slug":"nanopi-%e4%bd%bf%e7%94%a8-gparted-%e9%87%8d%e6%96%b0%e8%aa%bf%e6%95%b4%e5%bd%b1%e5%83%8f%e6%aa%94%e5%b0%ba%e5%af%b8","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=6457","title":{"rendered":"NanoPi - \u4f7f\u7528 GParted \u91cd\u65b0\u8abf\u6574\u5f71\u50cf\u6a94\u5c3a\u5bf8"},"content":{"rendered":"<h2>\u5b89\u88dd<\/h2>\n<pre class=\"lang:default decode:true\"># yum --enablerepo=remi install gparted<\/pre>\n<p>--<\/p>\n<h2>\u4fee\u6539\u5f71\u50cf\u6a94<\/h2>\n<p>\u6d41\u7a0b\u70ba<\/p>\n<ol>\n<li>truncate \u8abf\u6574\u5f71\u50cf\u6a94\u5927\u5c0f<\/li>\n<li>losetup \u5efa\u7acb\u865b\u64ec\u88dd\u7f6e<\/li>\n<li>gparted \u5be6\u969b\u8abf\u6574\u5206\u5272\u5340<\/li>\n<\/ol>\n<p>\u53c3\u8003<\/p>\n<ul>\n<li><a href=\"https:\/\/unix.stackexchange.com\/questions\/247256\/how-do-i-resize-a-partition-on-an-img-file\" target=\"_blank\" rel=\"noopener\">How do I resize a partition on an img file?<\/a><\/li>\n<li><a title=\"\u4f7f\u7528 losetup \u5efa\u7acb\u865b\u64ec\u78c1\u789f\" href=\"https:\/\/note.artchiu.org\/2008\/09\/29\/%e4%bd%bf%e7%94%a8-losetup-%e5%bb%ba%e7%ab%8b%e8%99%9b%e6%93%ac%e7%a3%81%e7%a2%9f\/\" target=\"_blank\" rel=\"bookmark noopener\">\u4f7f\u7528 losetup \u5efa\u7acb\u865b\u64ec\u78c1\u789f<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\"># truncate -s 4GB \/tmp\/nanopi-neo_sd_friendlycore-xenial_4.14_armhf_20190823.img \r\n# losetup \/dev\/loop10 \/tmp\/nanopi-neo_sd_friendlycore-xenial_4.14_armhf_20190823.img\r\n# partprobe \/dev\/loop10\r\n# gparted \/dev\/loop10\r\n# losetup -d \/dev\/loop10<\/pre>\n<p>\u57f7\u884c\u5b8c partprobe \uff0c\u5206\u5272\u51fa\u73fe\u5373\u53ef\u9032\u884c\u639b\u8f09<\/p>\n<pre class=\"lang:default decode:true\">[root@localhost mnt]# ls \/dev\/loop*\r\n\/dev\/loop10  \/dev\/loop10p1  \/dev\/loop10p2  \/dev\/loop10p3  \/dev\/loop-control<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Pi_image_GParted_resize.png\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-6458\" src=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Pi_image_GParted_resize-300x208.png\" alt=\"\" width=\"300\" height=\"208\" srcset=\"https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Pi_image_GParted_resize-300x208.png 300w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Pi_image_GParted_resize-768x532.png 768w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Pi_image_GParted_resize-433x300.png 433w, https:\/\/blog.hoyo.idv.tw\/wp-content\/uploads\/2019\/11\/Pi_image_GParted_resize.png 774w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u53e6\u5916\u6709\u4e00\u7a2e\u76f4\u63a5\u639b\u8f09\u7684\u65b9\u5f0f\uff0c\u4e0d\u904e\u9019\u7a2e\u65b9\u5f0f\u662f\u7121\u6cd5\u9032\u884c\u4fee\u6539<\/p>\n<ul style=\"color: #333333; font-style: normal;\">\n<li><a href=\"https:\/\/www.linuxquestions.org\/questions\/linux-general-1\/how-to-mount-img-file-882386\/\" target=\"_blank\" rel=\"noopener\">how to mount .img file<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\"># cd \/mnt\r\n# mount -t auto -o loop,offset=$((512*49152)) \/tmp\/nanopi-neo_sd_friendlycore-xenial_4.14_armhf_20190823.img .\/pi<\/pre>\n<p>--<\/p>\n<h2>\u5c07 loop \u8f49\u6210\u5f71\u50cf\u6a94<\/h2>\n<ul>\n<li><a href=\"https:\/\/major.io\/2010\/12\/14\/mounting-a-raw-partition-file-made-with-dd-or-dd_rescue-in-linux\/\" target=\"_blank\" rel=\"noopener\">Mounting a raw partition file made with dd or dd_rescue in Linux<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true\"># dd if=\/dev\/loop10 of=\/opt\/3g.img\r\n# truncate -s 2500MB \/opt\/3g.img<\/pre>\n<ul>\n<li><a style=\"font-style: normal; font-weight: 300;\" href=\"https:\/\/becoder.org\/linux-dd-backup-bootable-usb-drive-without-wasting-space\/\" target=\"_blank\" rel=\"noopener\">[Linux] dd \u6307\u4ee4\u4e0d\u6d6a\u8cbb\u7a7a\u9593\u5099\u4efd usb \u958b\u6a5f\u789f<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \"># fdisk -l\r\n\r\n \u6240\u7528\u88dd\u7f6e \u958b\u6a5f      \u958b\u59cb         \u7d50\u675f      \u5340\u584a   \u8b58\u5225\u865f  \u7cfb\u7d71\r\n\/dev\/loop11p1           49152      131071       40960    b  W95 FAT32\r\n\/dev\/loop11p2          131072     5060607     2464768   83  Linux\r\n\/dev\/loop11p3         5060608     5292031      115712   83  Linux\r\n<\/pre>\n<p>\u7d00\u9304\u6700\u5f8c\u5206\u5272\u5340\u7684\u7d50\u675f\u78c1\u5340\u6578\uff0c\u4f7f\u7528 dd \u6307\u4ee4\u88fd\u4f5c\u5f71\u50cf\u6a94<\/p>\n<pre class=\"lang:default decode:true\"># dd if=\/dev\/loop11 count=5292031 of=dd.img<\/pre>\n<p>--<\/p>\n<h2>\u4fee\u6539\u6a94\u6848\u5167\u5bb9<\/h2>\n<p>CentOS 7 \u7f3a\u5c11 mkimage<\/p>\n<pre class=\"lang:default decode:true\"># yum install uboot-tools<\/pre>\n<p>--<\/p>\n<h2>\u5176\u4ed6\u6ce8\u610f\u4e8b\u9805<\/h2>\n<p>ldsetup -d \u522a\u9664\u6210\u529f \/dev\/loop \u4e26\u4e0d\u6703\u6d88\u5931<\/p>\n<pre class=\"lang:default decode:true \"># losetup --detach-all<\/pre>\n<p>--<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"6457\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;1,161&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88dd # yum --enab...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"6457\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;1,161&nbsp;total views<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[308],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/6457"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6457"}],"version-history":[{"count":10,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/6457\/revisions"}],"predecessor-version":[{"id":12387,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/6457\/revisions\/12387"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6457"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6457"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6457"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}