tesla_matrix_led.jpg

Foreword

Tesla intriduced custom light show in its holiday update, and I would like to put Tesla dash cam, music, boombox, and custom light show all in one storage device (assumed to be an SSD in this post). By doing this, I can put my SSD in the glove box, which is locked in the case of a breakin. This can be achieved by partitioning the storage device into 4 partitions, during which I found it was a PITA to do with file system other than APFS. Then, I recalled that there was this system utility on macOS called diskutil. Thankfully, the man page is easy to grasp. Nonetheless, I decided to compile a blog post after some light reading.

Fun fact: diskutil along with many other binaries on my Intel based 16" MacBook Pro running macOS Monterey (version 12.1) is a universal binary or fat binary if you will.

lipo -info `which diskutil`

gives: Architectures in the fat file: /usr/sbin/diskutil are: x86_64 arm64e.
Not that it matters, lipo can also extract the useful part of a fat binary and discard the irrelevant part.

Prepare Your Device

Plug in your storage device and open a terminal emulator by using the key stroke: + Space, and search for instance Terminal.app or iTerm.app, followed by return to open the app.

Check The Device Identifier

Type the following command into your favorite terminal emulator:

diskutil list

You shoud see your device listed as the last entry, usually it’s disk2:

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk2

Partition Thy Drive

🛑 Make sure to make a backup, as this step wipe whatever is on your storage device. ⚠️

Run:

diskutil partitionDisk disk2 GPT ExFat BoomboxP 256Mi ExFat LightShowP 256Mi ExFat MusicP 2Gi ExFat TeslaCamP R
  • disk2 is the identifier obtained from previous step. Be sure to change it accordingly!
  • GPT is the partitioning scheme. MBR works just as well.
  • For each partition, a triplet specifying file system format, volume name, and size is given, following said partitioning scheme
  • ExFat BoomboxP 256Mi denotes that there will be a partition named BoomboxP of file system format ExFat, and of size 256 MiB.
  • Same goes for ExFat LightShowP 256Mi ExFat MusicP 2Gi, I would like my music partition to be 2 gigs, so there is that.
  • The R in ExFat TeslaCamP R stands for remainder.

When done, run diskutil list to make sure those partitions are created.

Optional Step

You will likely see this from diskutil list:

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:       Microsoft Basic Data BoomboxP                268.4 MB   disk2s2
   3:       Microsoft Basic Data LightShowP              268.4 MB   disk2s3
   4:       Microsoft Basic Data MusicP                  2.1 GB     disk2s4
   5:       Microsoft Basic Data TeslaCamP               497.2 GB   disk2s5

You could remove the unneeded EFI volume by running:

diskutil eraseVolume "Free Space" EFI disk2s1

Last But Not Least

For Tesla dash cam to work, a folder named TeslaCam have to be present in root directory. This is a simple one liner:

mkdir -p /Volumes/TeslaCamP/TeslaCam

Voila! The structure of the partition TeslaCamP:

└── TeslaCam

Now you can put at most 5 songs in a folder named Boombox in the partition BoomboxP, for example:

└── Boombox
    ├── Bruh.mp3
    ├── Cavalry.mp3
    ├── Chewbacca.mp3
    ├── DarthVader.mp3
    └── MoveBitchGetOutTheWay.mp3

Structure of the partition LightShowP as instructed by the Tesla GitHub repo:

└── LightShow
    ├── lightshow.fseq
    └── lightshow.mp3

Structure of the partition MusicP is rather flexible:

├── Your music folder A
│   ├── A.mp3
│   └── B.mp3
└── Your music folder B
    ├── A.mp3
    └── B.mp3