Skip to content

Instantly share code, notes, and snippets.

@yujunz
Last active December 29, 2023 16:48
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save yujunz/3cd981d507cbcdf63fc9ae33368d3044 to your computer and use it in GitHub Desktop.
Save yujunz/3cd981d507cbcdf63fc9ae33368d3044 to your computer and use it in GitHub Desktop.
Time machine on JuiceFS
JFS_BASE=/Users/yujunz/JuiceFS
JFS_NAME=rogerz-s3-cn-east-1-qiniu
BUNDLE=TimeMachine.sparsebundle
VOLUME=/Volumes/TimeMachine

# Mount JuiceFS
juicefs mount --cache-dir $JUICEFS_BASE/cache --batch 10 --writeback --metacache --opencache $JFS_NAME $JFS_BASE/$JFS_NAME

# Create sparse bundle
hdiutil create -size 600g -type SPARSEBUNDLE -fs "HFS+J" $BUNDLE
mv $BUNDLE $JFS_BASE/$JFS_NAME

# Attach and set as time machine destination
hdiutil attach -mountpoint $VOLUME $JFS/$BUNDLE
sudo tmutil setdestination -a $VOLUME

Force umount

➜  JuiceFS umount rogerz-s3-cn-east-1-qiniu
umount(/Users/yujunz/JuiceFS/rogerz-s3-cn-east-1-qiniu): Resource busy -- try 'diskutil unmount'
➜  JuiceFS diskutil umount rogerz-s3-cn-east-1-qiniu
Unmount failed for rogerz-s3-cn-east-1-qiniu
➜  JuiceFS umount -f rogerz-s3-cn-east-1-qiniu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment