So Dropbox is no longer supporting anything besides ext4 on linux as of Nov 7th 2018. Here's how to work around that WITHOUT superuser permissions.
First, create a sparse file of whatever size you'd like for your Dropbox folder.
Now we need to format this as ext4, But we want to make sure that we own the created file system, not the default of root.
Setup the loopback device with our EXT4 image
You may need to mount the device if it hasn't been already:
Check where our filesystem is mounted:
Move any existing data from the previous dropbox folder to the new location:
Link our new folder back to the dropbox folder
You can now start dropbox and sync away, the device will need to be mounted before dropbox is started.
Here's a script that could be used to set this up every time before dropbox is run:
First, create a sparse file of whatever size you'd like for your Dropbox folder.
$ truncate -s 5G ~/.Dropbox.imgNow we need to format this as ext4, But we want to make sure that we own the created file system, not the default of root.
$ mkfs.ext4 -E root_owner=$(id -u $USER):$(id -g $USER) ~/.Dropbox.imgSetup the loopback device with our EXT4 image
$ udisksctl loop-setup -f ~/.Dropbox.imgYou may need to mount the device if it hasn't been already:
$ udisksctl mount -b $CREATED_LOOP_DEVICECheck where our filesystem is mounted:
$ mount | grep Dropbox.imgMove any existing data from the previous dropbox folder to the new location:
$ mv ~/Dropbox/{.,}* /$MOUNTPOINT/OF/DROPBOX/IMAGE/UUID$Link our new folder back to the dropbox folder
$ ln -s /$MOUNTPOINT/OF/DROPBOX/IMAGE/UUID$/ ~/DropboxYou can now start dropbox and sync away, the device will need to be mounted before dropbox is started.
Here's a script that could be used to set this up every time before dropbox is run:
#!/usr/bin/env bash
#Dropbox local loopback file system workaround
LOOPFILE=$HOME/.Dropbox.img
LOOPSIZE=5G
#Check if the loopback file exists
if [ ! -f $LOOPFILE ]; then
# Create the loopback file
truncate -s 5G $LOOPFILE
# Create the filesystem
mkfs.ext4 -E root_owner=$(id -u $USER):$(id -g $USER) $LOOPFILE
#setup the loopback device
LOOPDEVICE="$(udisksctl loop-setup -f $LOOPFILE | awk '{print $5}' | sed 's/.$//')"
#Check if our loop file is mounted
if [ ! $(mount | grep -q $LOOPFILE) ]; then
#mount our loop file
udisksctl mount -b $LOOPDEVICE
fi
# get our mount point
MOUNT="$(mount | grep Dropbox.img | awk '{print $3}')"
# Move any existing data from our original folder to the new location
mv ~/Dropbox/{.,}* $MOUNT
# Remove the old Dropbox folder
rmdir ~/Dropbox
# Link the new mount to our Dropbox folder
ln -s $MOUNT ~/Dropbox
else
# Check if our loop has been created
if [ ! $(udisksctl dump | grep -q test) ]; then
#setup the loopback device
LOOPDEVICE="$(udisksctl loop-setup -f $LOOPFILE | awk '{print $5}' | sed 's/.$//')"
fi
#Check if our loop file is mounted
if [ ! mount | grep -q $LOOPFILE ]; then
#Find the loop file
LOOPDEVICE="$(udisksctl dump | grep -e ' Device:.*loop.*\| BackingFile:' | grep -B1 $LOOPFILE | head -1 | awk '{print $2}')"
#mount our loop file
udisksctl mount -b $LOOPDEVICE
fi
fi
# now launch dropbox
dropbox
Comments
Post a Comment