There are several potential advantages to using ext4, a Linux filesystem, on an SSD connected to your Tesla in the glove box. The Linux-specific filesystem is journaled, which means it has some protection against data corruption from disconnects. I switched to ext4 as my filesystem for the Tesla USB drive more than a year ago and from that point I no longer had data corruption problems. There are currently few resources for using the Linux filesystem ext4 for both TeslaCam and media files on the same drive. Consequently, I’ve created a step-by-step set of instructions to rectify this Internet knowledge gap. Please feel free to offer comments on how this could be improved.
Here are the steps I took to do this with a 500GB Samsung T7 SSD. It works perfectly with dashcam/Sentry clips as well as FLAC music files.
Commands to enter are highlighted in bold.
Connect your SSD to a Linux machine via the USB port. Now find which device this has been assigned to by looking at the recent log entries pertaining to the new USB drive:
[michael@ares ~]$ sudo dmesg -T
[…]
[Sun Jul 23 15:15:28 2023] usb 2-1.2: new high-speed USB device number 5 using ehci-pci
[Sun Jul 23 15:15:28 2023] usb 2-1.2: New USB device found, idVendor=04e8, idProduct=4001, bcdDevice= 1.00
[Sun Jul 23 15:15:28 2023] usb 2-1.2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[Sun Jul 23 15:15:28 2023] usb 2-1.2: Product: PSSD T7
[Sun Jul 23 15:15:28 2023] usb 2-1.2: Manufacturer: Samsung
[Sun Jul 23 15:15:28 2023] usb 2-1.2: SerialNumber: S5TMNS0T112060J
[Sun Jul 23 15:15:29 2023] scsi host7: uas
[Sun Jul 23 15:15:29 2023] scsi 7:0:0:0: Direct-Access Samsung PSSD T7 0 PQ: 0 ANSI: 6
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: Attached scsi generic sg10 type 0
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] 976773168 512-byte logical blocks: (500 GB/466 GiB)
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] Write Protect is off
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] Mode Sense: 43 00 00 00
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] Optimal transfer size 33553920 bytes
[Sun Jul 23 15:15:29 2023] sdj: sdj1
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] Attached SCSI disk
[michael@ares ~]$
In this example, the SSD has been assigned /dev/sdj. It is vitally important that you use the correct device for the upcoming commands, as they are destructive to the data on the drive. Don’t just copy the following commands that deal with partitioning and filesystem creation; make sure you appropriate alter the “/dev/sdXX” part to fit your particular situations.
Remove the current partition(s), make a gpt label, and add two new partitions. If there are more than one pre-existing partitions then you will need to execute subsequent commands “rm 2”, “rm 3”, and so forth until all existing partitions are removed.
[michael@ares ~]$ sudo parted /dev/sdj
GNU Parted 3.2
Using /dev/sdj
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Samsung PSSD T7 (scsi)
Disk /dev/sdj: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 500GB 500GB primary
(parted) rm 1
(parted) mklabel gpt
Warning: The existing disk label on /dev/sdj will be destroyed and all data on this disk will be
lost. Do you want to continue?
Yes/No? Yes
(parted) mkpart primary 0GB 200GB
(parted) mkpart primary 200GB 100%
(parted) print
Model: Samsung PSSD T7 (scsi)
Disk /dev/sdj: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 33.6MB 200GB 200GB primary
2 200GB 500GB 300GB primary
(parted) quit
Information: You may need to update /etc/fstab.
[michael@ares ~]$
There should now be two new partitions. The first, 200GB, we will use for saving TeslaCam clips. The second (rest of the drive) we will use for media files. Now we need to create filesystems on both of these partitions. Again, replace “sdj” with the appropriate device.
[michael@ares ~]$ sudo mkfs.ext4 /dev/sdj1
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 48823575 4k blocks and 12206080 inodes
Filesystem UUID: 3c4b7ab0-25b1-4d41-bc6e-af1edb8c29ab
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
[michael@ares ~]$ sudo mkfs.ext4 /dev/sdj2
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 73259938 4k blocks and 18317312 inodes
Filesystem UUID: 8e21991f-1e93-478f-905b-01597408046f
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
OPTIONAL, BUT SOMETIMES HELPFUL: We can create filesystem labels for our partitions:
[michael@ares ~]$ sudo e2label /dev/sdj1 "TESLACAM"
[michael@ares ~]$ sudo e2label /dev/sdj2 "MEDIA"
[michael@ares ~]$
Now create a mount point for both of these partitions:
[michael@ares mnt]$ sudo mkdir /mnt/tesla_SSD
[michael@ares mnt]$ sudo mkdir /mnt/tesla_SSD/teslacam
[michael@ares mnt]$ sudo mkdir /mnt/tesla_SSD/media
[michael@ares mnt]$
Next, mount both partitions:
[michael@ares mnt]$ sudo mount /dev/sdj1 /mnt/tesla_SSD/teslacam
[michael@ares mnt]$ sudo mount /dev/sdj2 /mnt/tesla_SSD/media
[michael@ares mnt]$
You can confirm that both mounted properly:
[michael@ares mnt]$ sudo mount | grep tesla
/dev/sdj1 on /mnt/tesla_SSD/teslacam type ext4 (rw,relatime,stripe=8191)
/dev/sdj2 on /mnt/tesla_SSD/media type ext4 (rw,relatime,stripe=8191)
Now create a directory called “TeslaCam” on the first partition, and assign the proper permissions to allow reading and writing. The user and group ID’s (1984 and 1999, respectively) were ones that I determined empirically by reading the SSD after the car had written to the TeslaCam directory.
[michael@ares mnt]$ sudo mkdir /mnt/tesla_SSD/teslacam/TeslaCam
[michael@ares mnt]$ sudo chmod -R a+rwx /mnt/tesla_SSD/teslacam
[michael@ares mnt]$ sudo chown -R 1984:1999 /mnt/tesla_SSD/teslacam
[michael@ares mnt]$
Next, create a directory on the second partition called “Music” or something to that effect:
[michael@ares mnt]$ sudo mkdir /mnt/tesla_SSD/media/Music
[michael@ares mnt]$
We’ll now copy your media files over to the new Music directory. Replace the source directory with the one appropriate for your situation. (NOTE: Trailing slashes, or lack thereof, are significant with rysnc.)
[michael@ares mnt]$ sudo rsync -avzh /path/to/source/media/top/directory /mnt/tesla_SSD/media/Music/
Now set permissions on the media partition. (I suspect the media partition is only used for reading, so the user and group ID’s might be less important for media, as long as there are universal read privileges.)
[michael@ares mnt]$ sudo chmod -R a+rwx /mnt/tesla_SSD/media
[michael@ares mnt]$ sudo chown -R 1984:1999 /mnt/tesla_SSD/media
[michael@ares mnt]$
Unmount the SSD so you can subsequently disconnect it from your Linux computer:
[michael@ares mnt]$ sudo umount /mnt/tesla_SSD/teslacam
[michael@ares mnt]$ sudo umount /mnt/tesla_SSD/media
[michael@ares mnt]$
Remove the external SSD and connect it to the USB port in the glove box. Touch the Media icon on the car's touchscreen, then at the top left (might be marked as Streaming or something like that) choose USB. You will be able to see the progress for scanning media files on the external drive.
Your drive should now function as both a dashcam storage and source for media!
Here are the steps I took to do this with a 500GB Samsung T7 SSD. It works perfectly with dashcam/Sentry clips as well as FLAC music files.
Commands to enter are highlighted in bold.
Connect your SSD to a Linux machine via the USB port. Now find which device this has been assigned to by looking at the recent log entries pertaining to the new USB drive:
[michael@ares ~]$ sudo dmesg -T
[…]
[Sun Jul 23 15:15:28 2023] usb 2-1.2: new high-speed USB device number 5 using ehci-pci
[Sun Jul 23 15:15:28 2023] usb 2-1.2: New USB device found, idVendor=04e8, idProduct=4001, bcdDevice= 1.00
[Sun Jul 23 15:15:28 2023] usb 2-1.2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[Sun Jul 23 15:15:28 2023] usb 2-1.2: Product: PSSD T7
[Sun Jul 23 15:15:28 2023] usb 2-1.2: Manufacturer: Samsung
[Sun Jul 23 15:15:28 2023] usb 2-1.2: SerialNumber: S5TMNS0T112060J
[Sun Jul 23 15:15:29 2023] scsi host7: uas
[Sun Jul 23 15:15:29 2023] scsi 7:0:0:0: Direct-Access Samsung PSSD T7 0 PQ: 0 ANSI: 6
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: Attached scsi generic sg10 type 0
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] 976773168 512-byte logical blocks: (500 GB/466 GiB)
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] Write Protect is off
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] Mode Sense: 43 00 00 00
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] Optimal transfer size 33553920 bytes
[Sun Jul 23 15:15:29 2023] sdj: sdj1
[Sun Jul 23 15:15:29 2023] sd 7:0:0:0: [sdj] Attached SCSI disk
[michael@ares ~]$
In this example, the SSD has been assigned /dev/sdj. It is vitally important that you use the correct device for the upcoming commands, as they are destructive to the data on the drive. Don’t just copy the following commands that deal with partitioning and filesystem creation; make sure you appropriate alter the “/dev/sdXX” part to fit your particular situations.
Remove the current partition(s), make a gpt label, and add two new partitions. If there are more than one pre-existing partitions then you will need to execute subsequent commands “rm 2”, “rm 3”, and so forth until all existing partitions are removed.
[michael@ares ~]$ sudo parted /dev/sdj
GNU Parted 3.2
Using /dev/sdj
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: Samsung PSSD T7 (scsi)
Disk /dev/sdj: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 500GB 500GB primary
(parted) rm 1
(parted) mklabel gpt
Warning: The existing disk label on /dev/sdj will be destroyed and all data on this disk will be
lost. Do you want to continue?
Yes/No? Yes
(parted) mkpart primary 0GB 200GB
(parted) mkpart primary 200GB 100%
(parted) print
Model: Samsung PSSD T7 (scsi)
Disk /dev/sdj: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 33.6MB 200GB 200GB primary
2 200GB 500GB 300GB primary
(parted) quit
Information: You may need to update /etc/fstab.
[michael@ares ~]$
There should now be two new partitions. The first, 200GB, we will use for saving TeslaCam clips. The second (rest of the drive) we will use for media files. Now we need to create filesystems on both of these partitions. Again, replace “sdj” with the appropriate device.
[michael@ares ~]$ sudo mkfs.ext4 /dev/sdj1
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 48823575 4k blocks and 12206080 inodes
Filesystem UUID: 3c4b7ab0-25b1-4d41-bc6e-af1edb8c29ab
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
[michael@ares ~]$ sudo mkfs.ext4 /dev/sdj2
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 73259938 4k blocks and 18317312 inodes
Filesystem UUID: 8e21991f-1e93-478f-905b-01597408046f
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
OPTIONAL, BUT SOMETIMES HELPFUL: We can create filesystem labels for our partitions:
[michael@ares ~]$ sudo e2label /dev/sdj1 "TESLACAM"
[michael@ares ~]$ sudo e2label /dev/sdj2 "MEDIA"
[michael@ares ~]$
Now create a mount point for both of these partitions:
[michael@ares mnt]$ sudo mkdir /mnt/tesla_SSD
[michael@ares mnt]$ sudo mkdir /mnt/tesla_SSD/teslacam
[michael@ares mnt]$ sudo mkdir /mnt/tesla_SSD/media
[michael@ares mnt]$
Next, mount both partitions:
[michael@ares mnt]$ sudo mount /dev/sdj1 /mnt/tesla_SSD/teslacam
[michael@ares mnt]$ sudo mount /dev/sdj2 /mnt/tesla_SSD/media
[michael@ares mnt]$
You can confirm that both mounted properly:
[michael@ares mnt]$ sudo mount | grep tesla
/dev/sdj1 on /mnt/tesla_SSD/teslacam type ext4 (rw,relatime,stripe=8191)
/dev/sdj2 on /mnt/tesla_SSD/media type ext4 (rw,relatime,stripe=8191)
Now create a directory called “TeslaCam” on the first partition, and assign the proper permissions to allow reading and writing. The user and group ID’s (1984 and 1999, respectively) were ones that I determined empirically by reading the SSD after the car had written to the TeslaCam directory.
[michael@ares mnt]$ sudo mkdir /mnt/tesla_SSD/teslacam/TeslaCam
[michael@ares mnt]$ sudo chmod -R a+rwx /mnt/tesla_SSD/teslacam
[michael@ares mnt]$ sudo chown -R 1984:1999 /mnt/tesla_SSD/teslacam
[michael@ares mnt]$
Next, create a directory on the second partition called “Music” or something to that effect:
[michael@ares mnt]$ sudo mkdir /mnt/tesla_SSD/media/Music
[michael@ares mnt]$
We’ll now copy your media files over to the new Music directory. Replace the source directory with the one appropriate for your situation. (NOTE: Trailing slashes, or lack thereof, are significant with rysnc.)
[michael@ares mnt]$ sudo rsync -avzh /path/to/source/media/top/directory /mnt/tesla_SSD/media/Music/
Now set permissions on the media partition. (I suspect the media partition is only used for reading, so the user and group ID’s might be less important for media, as long as there are universal read privileges.)
[michael@ares mnt]$ sudo chmod -R a+rwx /mnt/tesla_SSD/media
[michael@ares mnt]$ sudo chown -R 1984:1999 /mnt/tesla_SSD/media
[michael@ares mnt]$
Unmount the SSD so you can subsequently disconnect it from your Linux computer:
[michael@ares mnt]$ sudo umount /mnt/tesla_SSD/teslacam
[michael@ares mnt]$ sudo umount /mnt/tesla_SSD/media
[michael@ares mnt]$
Remove the external SSD and connect it to the USB port in the glove box. Touch the Media icon on the car's touchscreen, then at the top left (might be marked as Streaming or something like that) choose USB. You will be able to see the progress for scanning media files on the external drive.
Your drive should now function as both a dashcam storage and source for media!