【Mac】セブンイレブンのマルチコピー機と micro SDカード

こいつに PDF 入れて印刷しようとしたらできないのだが。

ファイルが認識されない。

「このサービスでプリントできるファイルがありません。」

 

🤔 diskutil でSDカードのフォーマットを変更する

以前、少しやってみたけど、再フォーマット変更。

👉 【macOS】ディスクユーティリティ で フォーマットが終わらない → SDカードが死んだ?


eraseDisk  [-noEFI] format name [APM[Format] | MBR[Format] | GPT[Format]] device

                Erase an existing disk, removing all volumes and writing out a
                new partitioning scheme containing one new empty file system
                volume.  If the partitioning scheme is not specified, then an
                appropriate one for the current machine is chosen.  Format is
                discussed below in the section for the partitionDisk verb.
                Ownership of the affected disk is required.
                If -noEFI is specified, do not create EFI partition on the
                target disk.

GUIDパーティションテーブル (英: GUID Partition Table, GPT) は、ハードディスクドライブ上のパーティションテーブルの配置に関する標準規格である。

これはインテルの提案しているEFI標準の一部であり、旧来のBIOSで使用されているマスターブートレコード (MBR) の置き換えを意図している。

macOS 10.4.0以降(一部機能は10.4.6以降)。Windows IA-64アーキテクチャのOSでは当初から、EFIとGPTからの起動をサポートしている。

👉 GUIDパーティションテーブル - Wikipedia

exFAT(イーエックスファット、Extended File Allocation Table)は、マイクロソフトによって2006年に導入されたプロプライエタリなファイルシステムである。USBフラッシュドライブやSDカードなどのフラッシュドライブ向けに最適化がされている。

32 GiBを超えるメモリーカード規格であるSDXC/SDUCメモリーカードやメモリースティックXCの標準ファイルシステムに採用されている。

Macにおいては、2010年にAppleにより、SDXCカードスロットの付いたMac miniとiMacがリリースされ付属する専用Mac OS X v10.6.4が対応した後、Mac OS X v10.6.5以降で対応している。

👉 exFAT - Wikipedia

ということなので、以下で再フォーマットしたらいけた!


❯ diskutil eraseDisk ExFAT SDCARD-32GB GPT /dev/disk18

そのときの詳細は以下。


❯ diskutil list /dev/disk18
/dev/disk18 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *32.0 GB    disk18
   1:                        EFI EFI                     209.7 MB   disk18s1
   2:       Microsoft Basic Data SDCARD-32GB             31.8 GB    disk18s2

❯ sudo fdisk /dev/disk18
Disk: /dev/disk18	geometry: 3893/255/63 [62552064 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -   62552063] <Unknown ID>
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused

❯ diskutil info /dev/disk18
   Device Identifier:         disk18
   Device Node:               /dev/disk18
   Whole:                     Yes
   Part of Whole:             disk18
   Device / Media Name:       Built In SDXC Reader

   Volume Name:               Not applicable (no file system)
   Mounted:                   Not applicable (no file system)
   File System:               None

   Content (IOContent):       GUID_partition_scheme
   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  Secure Digital
   SMART Status:              Not Supported

   Disk Size:                 32.0 GB (32026656768 Bytes) (exactly 62552064 512-Byte-Units)
   Device Block Size:         512 Bytes

   Media OS Use Only:         No
   Media Read-Only:           No
   Volume Read-Only:          Not applicable (no file system)

   Device Location:           Internal
   Removable Media:           Removable
   Media Removal:             Software-Activated

   Solid State:               Info not available
   Virtual:                   No


❯ diskutil info /dev/disk18s1
   Device Identifier:         disk18s1
   Device Node:               /dev/disk18s1
   Whole:                     No
   Part of Whole:             disk18

   Volume Name:               EFI
   Mounted:                   No

   Partition Type:            EFI
   File System Personality:   MS-DOS FAT32
   Type (Bundle):             msdos
   Name (User Visible):       MS-DOS (FAT32)

   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  Secure Digital
   SMART Status:              Not Supported
   Volume UUID:               0E239BC6-F960-3107-89CF-1C97F78BB46B
   Disk / Partition UUID:     B2A0E0B8-480A-49E7-9B99-5522EA52AC0C
   Partition Offset:          20480 Bytes (40 512-Byte-Device-Blocks)

   Disk Size:                 209.7 MB (209715200 Bytes) (exactly 409600 512-Byte-Units)
   Device Block Size:         512 Bytes

   Volume Total Space:        0 B (0 Bytes) (exactly 0 512-Byte-Units)
   Volume Free Space:         0 B (0 Bytes) (exactly 0 512-Byte-Units)

   Media OS Use Only:         No
   Media Read-Only:           No
   Volume Read-Only:          Not applicable (not mounted)

   Device Location:           Internal
   Removable Media:           Removable
   Media Removal:             Software-Activated

   Solid State:               Info not available


❯ diskutil info /dev/disk18s2
   Device Identifier:         disk18s2
   Device Node:               /dev/disk18s2
   Whole:                     No
   Part of Whole:             disk18

   Volume Name:               SDCARD-32GB
   Mounted:                   Yes
   Mount Point:               /Volumes/SDCARD-32GB

   Partition Type:            Microsoft Basic Data
   File System Personality:   ExFAT
   Type (Bundle):             exfat
   Name (User Visible):       ExFAT

   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  Secure Digital
   SMART Status:              Not Supported
   Volume UUID:               97714F2C-DA45-3BEF-8039-C11F9BD9EA1C
   Disk / Partition UUID:     411FC09E-E1B0-4683-A424-FEB1464C7C86
   Partition Offset:          210763776 Bytes (411648 512-Byte-Device-Blocks)

   Disk Size:                 31.8 GB (31814844416 Bytes) (exactly 62138368 512-Byte-Units)
   Device Block Size:         512 Bytes

   Volume Total Space:        31.8 GB (31809634304 Bytes) (exactly 62128192 512-Byte-Units)
   Volume Used Space:         12.4 MB (12386304 Bytes) (exactly 24192 512-Byte-Units) (0.0%)
   Volume Free Space:         31.8 GB (31797248000 Bytes) (exactly 62104000 512-Byte-Units) (100.0%)
   Allocation Block Size:     512 Bytes

   Media OS Use Only:         No
   Media Read-Only:           No
   Volume Read-Only:          No

   Device Location:           Internal
   Removable Media:           Removable
   Media Removal:             Software-Activated

   Solid State:               Info not available

結構、昔に購入したものだけど、まだ使えてよかった。

👉 【macOS】ディスクユーティリティ で フォーマットが終わらない → SDカードが死んだ?
👉 partition - `diskutil list` shows type Windows_NTFS, but `Disk Utility.app` shows type ExFAT. So What is the type? - Ask Different


【macOS】ディスクユーティリティ で フォーマットが終わらない → SDカードが死んだ?

 

🧑🏻‍💻 ディスクユーティリティ はよくスタックする?

SDカードを再フォーマットしようとしたら、

これがなぜか処理が終わらない。

👉 Mac STUCK on disk utility process - “wait… - Apple Community

👉 Stuck at disk utility , cannot reinstall mac or erase the disks? What to do ? : r/MacOS

不安定なのか。

どうしようもないので、

ディスクユーティリティ を強制終了したり、

無理やりカードを引き抜いたりしてました。

 

🧑🏻‍💻 純正 diskutil を使う

GUI ではなかなか症状が分かりづらいので、

diskutil で進みます。

洗練された自在なツールに見えます。


❯ diskutil
Disk Utility Tool
Utility to manage local disks and volumes
Most commands require an administrator or root user

WARNING: Most destructive operations are not prompted

Usage:  diskutil [quiet] <verb> <options>, where <verb> is as follows:

     list                 (List the partitions of a disk)
     info[rmation]        (Get information on a specific disk or partition)
     listFilesystems      (List file systems available for formatting)
     listClients          (List all current disk management clients)
     activity             (Continuous log of system-wide disk arbitration)

     u[n]mount            (Unmount a single volume)
     unmountDisk          (Unmount an entire disk (all volumes))
     eject                (Eject a disk)
     mount                (Mount a single volume)
     mountDisk            (Mount an entire disk (all mountable volumes))

     enableJournal        (Enable HFS+ journaling on a mounted HFS+ volume)
     disableJournal       (Disable HFS+ journaling on a mounted HFS+ volume)
     moveJournal          (Move the HFS+ journal onto another volume)
     enableOwnership      (Exact on-disk User/Group IDs on a mounted volume)
     disableOwnership     (Ignore on-disk User/Group IDs on a mounted volume)

     rename[Volume]       (Rename a volume)

     verifyVolume         (Verify the file system data structures of a volume)
     repairVolume         (Repair the file system data structures of a volume)
     verifyDisk           (Verify the components of a partition map of a disk)
     repairDisk           (Repair the components of a partition map of a disk)
     resetFusion          (Reset the components of a machine's Fusion Drive)

     eraseDisk            (Erase an existing disk, removing all volumes)
     eraseVolume          (Erase an existing volume)
     reformat             (Erase an existing volume with same name and type)
     eraseOptical         (Erase optical media (CD/RW, DVD/RW, etc.))
     zeroDisk             (Erase a disk, writing zeros to the media)
     randomDisk           (Erase a disk, writing random data to the media)
     secureErase          (Securely erase a disk or freespace on a volume)

     partitionDisk        ((re)Partition a disk, removing all volumes)
     addPartition         (Create a new partition to occupy free space)
     splitPartition       (Split an existing partition into two or more)
     mergePartitions      (Combine two or more existing partitions into one)
     resizeVolume         (Resize a volume, increasing or decreasing its size)

     appleRAID <verb>     (Perform additional verbs related to AppleRAID)
     coreStorage <verb>   (Perform additional verbs related to CoreStorage)
     apfs <verb>          (Perform additional verbs related to APFS)
     image <verb>         (Perform additional verbs related to DiskImage)

diskutil <verb> with no options will provide help on that verb

SDカードをチェックしてみます。

私の環境では、SDカードは /dev/disk18 です。


❯ diskutil verifyDisk /dev/disk18
Nonexistent, unknown, or damaged partition map scheme
If you are sure this disk contains a (damaged) APM, MBR, or GPT partition
scheme, you might be able to repair it with "diskutil repairDisk /dev/disk18"

❯ diskutil repairDisk /dev/disk18
Nonexistent, unknown, or damaged partition map scheme
If you are sure this disk contains a (damaged) APM, MBR, or GPT partition map,
you can hereby try to repair it enough to be recognized as a map; another
"diskutil repairDisk /dev/disk18" might then be necessary for further repairs
Proceed? (y/N) y
Error repairing map: MediaKit reports bad partition or no map found (-5324)

げ、死んでますか?

 

🧑🏻‍💻 dd で復活!

イメージなどをディスクに書き込んだりする dd コマンドを使います。


DD(1)                       General Commands Manual                      DD(1)

NAME
     dd – convert and copy a file

SYNOPSIS
     dd [operands ...]

DESCRIPTION
     The dd utility copies the standard input to the standard output.  Input
     data is read and written in 512-byte blocks.  If input reads are short,
     input from multiple reads are aggregated to form the output block.  When
     finished, dd displays the number of complete and partial input and output
     blocks and truncated input records to the standard error output.

以下のようにやると復活したっぽい。


❯ diskutil unmountDisk force /dev/disk18
Forced unmount of all volumes on disk18 was successful

❯ sudo dd if=/dev/zero of=/dev/disk18 bs=1024 count=1024
1024+0 records in
1024+0 records out
1048576 bytes transferred in 4.508285 secs (232589 bytes/sec)

❯ diskutil partitionDisk /dev/disk18 GPT JHFS+ "My External HD" 0g
Started partitioning on disk18
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk18s2 as Mac OS Extended (Journaled) with name My External HD
Initialized /dev/rdisk18s2 as a 30 GB case-insensitive HFS Plus volume with a 8192k journal
Mounting disk
Finished partitioning on disk18
/dev/disk18 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *32.0 GB    disk18
   1:                        EFI EFI                     209.7 MB   disk18s1
   2:                  Apple_HFS My External HD          31.7 GB    disk18s2

👉 Disk Utility fails to erase/format an external HDD (El Capitan). "Mediakit reports not enough space on device for requested operation." : r/applehelp
👉 mac - How can I resolve the error "MediaKit reports partition (map) too small"? - Super User

/dev/zeroは、制限をかけてあげないとファイルシステムが埋まるまで
ゼロで埋めてしまうみたいです。

👉 /dev/nullと/dev/zeroの違いまとめ #Linux - Qiita

 

🧑🏻‍💻 復活を確認して、再フォーマットをする

以下のように復活の確認をして、

やりたかった再フォーマットまでできました!


❯ diskutil verifyDisk /dev/disk18
Started partition map verification on disk18
Checking prerequisites
Checking the partition list
Checking the partition map size
Checking for an EFI system partition
Checking the EFI system partition's size
Checking the EFI system partition's file system
Checking the EFI system partition's folder content
Checking all HFS data partition loader spaces
Checking booter partitions
Checking Core Storage Physical Volume partitions
The partition map appears to be OK
Finished partition map verification on disk18

❯ diskutil eraseDisk FAT32 SDCARD-32GB MBR /dev/disk18
Started erase on disk18
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk18s1 as MS-DOS (FAT32) with name SDCARD-32GB
512 bytes per physical sector
/dev/rdisk18s1: 62513312 sectors in 1953541 FAT32 clusters (16384 bytes/cluster)
bps=512 spc=32 res=32 nft=2 mid=0xf8 spt=32 hds=255 hid=8192 drv=0x80 bsec=62543872 bspf=15263 rdcl=2 infs=1 bkbs=6
Mounting disk
Finished erase on disk18

❯ diskutil list /dev/disk18
/dev/disk18 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *32.0 GB    disk18
   1:                 DOS_FAT_32 SDCARD-32GB             32.0 GB    disk18s1

❯ diskutil info /dev/disk18
   Device Identifier:         disk18
   Device Node:               /dev/disk18
   Whole:                     Yes
   Part of Whole:             disk18
   Device / Media Name:       Built In SDXC Reader

   Volume Name:               Not applicable (no file system)
   Mounted:                   Not applicable (no file system)
   File System:               None

   Content (IOContent):       FDisk_partition_scheme
   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  Secure Digital
   SMART Status:              Not Supported

   Disk Size:                 32.0 GB (32026656768 Bytes) (exactly 62552064 512-Byte-Units)
   Device Block Size:         512 Bytes

   Media OS Use Only:         No
   Media Read-Only:           No
   Volume Read-Only:          Not applicable (no file system)

   Device Location:           Internal
   Removable Media:           Removable
   Media Removal:             Software-Activated

   Solid State:               Info not available
   Virtual:                   No

 

🧑🏻‍💻 まとめ

GUI ディスクユーティリティ はあやしいので diskutil コマンド。

Windows / Mac 互換なら、FAT32 の MBR が今は普通で互換性があるか。


diskutil eraseDisk FAT32 SDCARD MBR /dev/disk18

# 容量・ファイルサイズが大きい場合
diskutil eraseDisk ExFAT SDCARD GPT /dev/disk18

先人先生、今回もありがとうございます。

あと、フォーマットに関しては以下が見やすかったです。

👉 ファイルシステム(FAT32、FAT16、NTFS、exFAT、HFS、HFS+、APFS)の違いについて | バッファロー

👉 【Mac】セブンイレブンのマルチコピー機と micro SDカード


【macOS】DeskPad - A virtual monitor for screen sharing を使ってみる

少し話題になっていたので気になっていました。

👉 Stengo/DeskPad: A virtual monitor for screen sharing

仮想モニター?

 

🤔 よく分からないので使ってみた

ディスプレイ設定ウインドウが開いています。

DeskPad を起動させると、
拡張ディスプレイとして認識されるので、

レイアウトを整えて、

設定のウインドウを拡張ディスプレイの方向に移動していくと、

DeskPad 上に移動して表示される。

動画。



そんな感じです。

すげえ!

 

🤔 まとめ

これ、いろいろ使えそうですね。