{"id":1941,"date":"2021-09-07T14:23:17","date_gmt":"2021-09-07T05:23:17","guid":{"rendered":"https:\/\/sirius10.net\/blog\/wordpress\/?p=1941"},"modified":"2021-09-15T11:49:41","modified_gmt":"2021-09-15T02:49:41","slug":"post-1941","status":"publish","type":"post","link":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/2021\/09\/07\/1941\/","title":{"rendered":"Raspberry Pi \u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7(2)"},"content":{"rendered":"\n<p>\u3000\u3053\u306e\u30b5\u30fc\u30d0\u306b USB \u30cf\u30d6\u3092\u3064\u306a\u3052\u3001\u305d\u306e\u30cf\u30d6\u306b\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\u3092 4 \u500b\u4ed8\u3051\u307e\u3057\u305f\u3002\u305d\u308c\u305e\u308c\u306e\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\u306b\u5185\u8535\u3055\u305b\u3066\u3044\u308b MicroSD \u3068\u540c\u3058\u5bb9\u91cf\u306e MicroSD \u3092\u4ed8\u3051\u307e\u3057\u305f\u3002\u305d\u3057\u3066\u3001\u4e00\u3064\u306f\u6708\u6b21\u3001\u4e00\u3064\u306f\u9031\u6b21\u3001\u6b8b\u308a\u306e\uff12\u3064\u306f\u65e5\u6b21\u3092\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3055\u305b\u3066\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3057\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\uff11-1-1024x928.jpg\" alt=\"\" class=\"wp-image-2001\" width=\"545\" height=\"494\" srcset=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\uff11-1-1024x928.jpg 1024w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\uff11-1-300x272.jpg 300w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\uff11-1-768x696.jpg 768w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\uff11-1-1536x1392.jpg 1536w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\uff11-1.jpg 1960w\" sizes=\"auto, (max-width: 545px) 100vw, 545px\" \/><figcaption>USB2.0 \u30ab\u30fc\u30c9\u30ea\u30fc\u30c0<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u3000Raspberry Pi 3B \u306b\u4ed8\u3051\u308b\u306e\u3067\u3001USB 2.0 \u5bfe\u5fdc\u306e\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\u3067\u3059\u3002\u4ed6\u306eRaspberry Pi \u3067\u3082\u4f7f\u304a\u3046\u3068\u601d\u3063\u305f\u306e\u3067 10 \u500b\u8cb7\u3044\u307e\u3057\u305f\u3002Amazon \u3067 1 \u500b 326 \u5186\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/MicroSD1-1-1024x814.jpg\" alt=\"\" class=\"wp-image-2002\" width=\"550\" height=\"436\" srcset=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/MicroSD1-1-1024x814.jpg 1024w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/MicroSD1-1-300x238.jpg 300w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/MicroSD1-1-768x610.jpg 768w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/MicroSD1-1-1536x1221.jpg 1536w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/MicroSD1-1-2048x1627.jpg 2048w\" sizes=\"auto, (max-width: 550px) 100vw, 550px\" \/><figcaption>Transcend \u306e MicroSD<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u3000\u540c\u3058\u304fAmazon \u3067 Transcend \u306e 32GB \u306e MicroSD \u3082 10 \u500b\u8cb7\u3044\u307e\u3057\u305f\u30021 \u500b 899 \u5186\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/MicroSD\u5411\u304d-1.jpg\" alt=\"\" class=\"wp-image-2004\" width=\"278\" height=\"222\"\/><figcaption>MicroSD \u3092\u523a\u3059\u5411\u304d<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/MicorSD\u3074\u3063\u305f\u308a-1.jpg\" alt=\"\" class=\"wp-image-2005\" width=\"279\" height=\"226\" srcset=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/MicorSD\u3074\u3063\u305f\u308a-1.jpg 756w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/MicorSD\u3074\u3063\u305f\u308a-1-300x243.jpg 300w\" sizes=\"auto, (max-width: 279px) 100vw, 279px\" \/><figcaption>\u5965\u307e\u3067\u523a\u3057\u305f\u3068\u3053\u308d<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u3000\u3000\u9ec4\u8272\u3044\u30dd\u30c3\u30c1\u306f MicroSD \u306e\u30a4\u30b8\u30a7\u30af\u30c8\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/USB\u30cf\u30d61-1-1024x828.jpg\" alt=\"\" class=\"wp-image-2006\" width=\"592\" height=\"478\" srcset=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/USB\u30cf\u30d61-1-1024x828.jpg 1024w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/USB\u30cf\u30d61-1-300x242.jpg 300w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/USB\u30cf\u30d61-1-768x621.jpg 768w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/USB\u30cf\u30d61-1-1536x1241.jpg 1536w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/09\/USB\u30cf\u30d61-1-2048x1655.jpg 2048w\" sizes=\"auto, (max-width: 592px) 100vw, 592px\" \/><figcaption>USB \u30cf\u30d6<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u3000USB 2.0 \u306e\u30cf\u30d6\u3082 3 \u500b\u8cb7\u3044\u307e\u3057\u305f\u30021 \u500b 498 \u5186\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u4ed6\u306b\u3082 HDMI \u30b3\u30f3\u30d0\u30fc\u30bf\u3084\u3001GPiCASE, Raspberry Pi 4B(8GB) \u3068\u304b\u3044\u308d\u3044\u308d\u8cb7\u3044\u307e\u3057\u305f\u3002\u5f8c\u3067\u8a18\u4e8b\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u307e\u305a\u30014 \u3064\u5168\u90e8\u3001\u624b\u52d5\u3067\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002\u30c7\u30d0\u30a4\u30b9\u306f sda \u301c sdd \u3068\u306a\u308a\u307e\u3059\u3002\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u65e5\u6b21\u304c\u308f\u304b\u308b\u3088\u3046\u306b \/etc\/backup_mark \u306b\u65e5\u6642\u3092\u51fa\u529b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted console\">$ sudo bash -c \"date &gt; \/etc\/backup_mark\"\n$ sudo rpi-clone sda\n\nBooted disk: mmcblk0 31.6GB                Destination disk: sda 32.0GB\n---------------------------------------------------------------------------\nPart      Size    FS     Label           Part   Size    FS     Label\n1 \/boot   256.0M  fat32  --              1       29.8G  fat32  --\n2 root     29.2G  ext4   rootfs                                  \n---------------------------------------------------------------------------\n== Initialize: IMAGE partition table - partition number mismatch: 2 -&gt; 1 ==\n1 \/boot               (48.0M used)   : MKFS  SYNC to sda1\n2 root                (3.8G used)    : RESIZE  MKFS  SYNC to sda2\n---------------------------------------------------------------------------\nRun setup script       : no.\nVerbose mode           : no.\n-----------------------:\n** WARNING **          : All destination disk sda data will be overwritten!\n-----------------------:\n\nInitialize and clone to the destination disk sda?  (yes\/no): <span style=\"background-color: #8b4513\" class=\"background-color\">yes<\/span>\nOptional destination ext type file system label (16 chars max): <span style=\"background-color: #8b4513\" class=\"background-color\">Daily1<\/span>\n\nInitializing\n  Imaging past partition 1 start.\n  =&gt; dd if=\/dev\/mmcblk0 of=\/dev\/sda bs=1M count=8 ...\n  Resizing destination disk last partition ...\n    Resize success.\n  Changing destination Disk ID ...\n  =&gt; mkfs -t vfat -F 32  \/dev\/sda1 ...\n  =&gt; mkfs -t ext4 -L Daily1 \/dev\/sda2 ...\n\nSyncing file systems (can take a long time)\nSyncing mounted partitions:\n  Mounting \/dev\/sda2 on \/mnt\/clone\n  =&gt; rsync \/\/ \/mnt\/clone with-root-excludes ...\n  Mounting \/dev\/sda1 on \/mnt\/clone\/boot\n  =&gt; rsync \/boot\/ \/mnt\/clone\/boot  ...\n\nEditing \/mnt\/clone\/boot\/cmdline.txt PARTUUID to use ea91591e\nEditing \/mnt\/clone\/etc\/fstab PARTUUID to use ea91591e\n===============================\nDone with clone to \/dev\/sda\n   Start - 15:50:08    End - 15:55:54    Elapsed Time - 5:46\n\nCloned partitions are mounted on \/mnt\/clone for inspection or customizing. \n\nHit Enter when ready to unmount the \/dev\/sda partitions ...<span style=\"background-color: #8b4513\" class=\"background-color\">ENTER<\/span>\n  unmounting \/mnt\/clone\/boot\n  unmounting \/mnt\/clone\n===============================\n<\/pre>\n\n\n\n<p>\u30009\u5206\u304f\u3089\u3044\u3067\u7d42\u308f\u308a\u307e\u3057\u305f\u3002\u6b8b\u308a\u3082\u540c\u69d8\u306b\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted console\">$ sudo rpi-clone sdb\n\u30fb\n\u30fb\n$ sudo rpi-clone sdc\n\u30fb\n\u30fb\n$ sudo rpi-clone sdd\n\u30fb\n\u30fb<\/pre>\n\n\n\n<p>\u3000\u5f8c\u306f\u3001\u30ed\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3055\u305b\u308b SHELL \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u3066\u3001cron \u306b\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\/root\/bin\/backup \u306b\u4fdd\u5b58\u3057\u3066\u5b9f\u884c\u6a29\u3092\u4ed8\u3051\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted file\">#!\/bin\/bash\n\nPATH=\/usr\/local\/sbin:\/usr\/sbin:\/sbin:\/usr\/local\/bin:$PATH\n\n# Definition of disk identifier\nid_monthly=\"0xa3d1a5d4\"\nid_weekly=\"0x000e3211\"\nid_daily1=\"0xea91591e\"\nid_daily2=\"0x766a0e36\"\n\ndevice=\nclone=rpi-clone\n# get date\nday=$(date +%d)\nweek=$(date +%w)\nn=$(expr ${week} % 2)\n\n# check backup devices\nfor check in \/dev\/sd?\ndo\n    if [ -b ${check} ]; then\n        id=$(fdisk -l ${check} | grep \"Disk identifier:\")\n        id=${id##*: }\n        if [ \"${id}\" == \"${id_monthly}\" ]; then\n            dev_monthly=${check}\n        elif [ \"${id}\" == \"${id_weekly}\" ]; then\n            dev_weekly=${check}\n        elif [ \"${id}\" == \"${id_daily1}\" ]; then\n            dev_daily1=${check}\n        elif [ \"${id}\" == \"${id_daily2}\" ]; then\n            dev_daily2=${check}\n        fi\n    fi\ndone\n\n# day = 1  : monthly backup\n# week = 0 : weekly backup\n# n = 0    : daily1 backup\n# other    : daily2 backup\nif [ \"${day}\" -eq 1 -a \"${dev_monthly}\" != \"\" ]; then\n    device=${dev_monthly##*\/}\nelif [ \"${week}\" -eq 0 -a \"${dev_weekly}\" != \"\" ]; then\n    device=${dev_weekly##*\/}\nelif [ \"${n}\" -eq 0 -a \"${dev_daily1}\" != \"\" ]; then\n    device=${dev_daily1##*\/}\nelif [ \"${dev_daily2}\" != \"\" ]; then\n    device=${dev_daily2##*\/}\nfi\n\nif [ \"${device}\" != \"\" ]; then\n    echo \"Backup to ${device}.\"\n    date &gt; \/etc\/backup_mark\n    time ${clone} ${device} -q\nelse\n    echo \"Backup device not found.\"\nfi<\/pre>\n\n\n\n<p>\u3000\u6bce\u6708 1 \u65e5\u306b\u6708\u6b21\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u3001\u305d\u3046\u3067\u306a\u3051\u308c\u3070\u65e5\u66dc\u306b\u9031\u6b21\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u3001\u305d\u308c\u4ee5\u5916\u306f 2 \u679a\u306b\u4ea4\u4e92\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u5148\u306f\u3001\u9593\u9055\u308f\u306a\u3044\u3088\u3046\u306b\u3001Disk identifier \u3092\u4f7f\u3063\u3066\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u5148\u3092\u6c7a\u3081\u3066\u3044\u307e\u3059\u3002id_monthly \u301c id_daily2 \u307e\u3067\u3001\u5b9f\u969b\u306e Disk identifier \u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000Disk identifier \u306f fdisk -l \u3067\u8868\u793a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted console\">$ fdisk -l \/dev\/sdc\nDisk \/dev\/sdc: 30.2 GiB, 32457621504 bytes, 63393792 sectors\nDisk model: USB Flash Disk  \nUnits: sectors of 1 * 512 = 512 bytes\nSector size (logical\/physical): 512 bytes \/ 512 bytes\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisklabel type: dos\nDisk identifier: <span style=\"background-color: #800080\" class=\"background-color\">0xc3072e18<\/span>\n\nDevice     Boot Start      End  Sectors  Size Id Type\n\/dev\/sdc1  *       32 63393791 63393760 30.2G  c W95 FAT32 (LBA)<\/pre>\n\n\n\n<p>\u3000\u5bfe\u8c61\u306e Disk identifier \u304c\u898b\u3064\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u4f55\u3082\u3057\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p>\u3000\u6bce\u65e5\u5348\u524d 3 \u6642\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3059\u308b\u3059\u308b\u3088\u3046\u306b cron \u306b\u767b\u9332\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted console\">$ sudo crontab -e<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted file\">0 3 * * * \/root\/bin\/backup<\/pre>\n\n\n\n<p>\u3000\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3057\u305f MicroSD \u3092Raspberry Pi \u306b\u5185\u8535\u3055\u305b\u3066\u8d77\u52d5\u3059\u308b\u3068\u3053\u308d\u307e\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002\u30b5\u30fc\u30d0\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306f\u3053\u308c\u3067\u3044\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u3053\u306e\u30b5\u30fc\u30d0\u306b USB \u30cf\u30d6\u3092\u3064\u306a\u3052\u3001\u305d\u306e\u30cf\u30d6\u306b\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\u3092 4 \u500b\u4ed8\u3051\u307e\u3057\u305f\u3002\u305d\u308c\u305e\u308c\u306e\u30ab\u30fc\u30c9\u30ea\u30fc\u30c0\u306b\u5185\u8535\u3055\u305b\u3066\u3044\u308b MicroSD \u3068\u540c\u3058\u5bb9\u91cf\u306e MicroSD \u3092\u4ed8\u3051\u307e\u3057\u305f\u3002\u305d\u3057\u3066\u3001\u4e00\u3064\u306f\u6708\u6b21\u3001\u4e00\u3064\u306f\u9031\u6b21\u3001\u6b8b\u308a\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1941","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=1941"}],"version-history":[{"count":14,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1941\/revisions"}],"predecessor-version":[{"id":2011,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1941\/revisions\/2011"}],"wp:attachment":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=1941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=1941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=1941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}