Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save paulproteus/b45c63299280cac3dfee44227c4abd2d to your computer and use it in GitHub Desktop.
Save paulproteus/b45c63299280cac3dfee44227c4abd2d to your computer and use it in GitHub Desktop.
Upload a 3TB block device straight to GDrive
https://github.com/labbots/google-drive-upload
+ patch out some `-f` checks to be `-e` (since `-f` is false on a block device)
+ replace `wc -c` with `blockdev --getsize64 $filename` to avoid spending 6 hours on `wc -c` before even uploading
+ `cp -a` the block device to /tmp/ with a nice filename, so google-drive-upload uses that as the GDrive filename
Wait 6 hours or so.
Then figure out the MD5 thing to validate the upload.
Use https://developers.google.com/drive/api/v3/reference/files/list?apix_params=%7B%22fields%22%3A%22files(md5Checksum%2CoriginalFilename%2CmimeType)%22%7D
(note `params`)
Run `md5sum < /dev/sdb` (or whatever) and make sure the md5sum matches.
The command-line client wants to set the MIME type to some block device MIME type. However, when I do the query above, it seems to believe it's application/octet-stream, which is good. If the md5sum is fine, I guess whatever re: MIME type.
@paulproteus
Copy link
Author

@paulproteus
Copy link
Author

TODO: Look into rclone, plexdrive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment