Re:My one-liner Linux Dropbox client
by greatquux on Tuesday December 25, 2018 @09:11AM
(#18757471)
Dropbox will work if you just create a local loopback file for an ext4 filesystem and mount the Dropbox folder on it.
[ Parent
| on HN ]
Re:My one-liner Linux Dropbox client
by algo646464 on Tuesday December 25, 2018 @12:10PM
(#18758088)
The above is a great answer.
To expand on this (from some googling). All of this requires root.
1) Create a sparse file (actual size depends on usage)
truncate -s 100G /home/zzz/Dropbox.image
2) Create a ext4 filesystem on it mkfs.ext4 -m0 /home/zzz/Dropbox.image
3) Mount it as a loopback file system sudo mount /home/zzz/Dropbox.image /home/zzz/Dropbox-fs
4) Create / Copy your dropbox folder to Dropbox-fs sudo mkdir /home/zzz/Dropbox-fs/Dropbox
sudo chown -R zzz.zzz /home/zzz/Dropbox-fs/Dropbox
cp -r /home/zzz/Dropbox-original /home/zzz/Dropbox-fs/Dropbox
5) Start Dropbox and point it to the new location6) If we want to mount this automatically at login. Adding it to /etc/fstab may not work because of encryption.
But perhaps some script at login to mount it will work. For example, we can create a script at /usr/local/bin/mountDB.sh and then add a line to /etc/sudoers
zzz ALL=(root) NOPASSWD: /usr/local/bin/mountDB.sh
Then somehow call this script at login of user zzz.I've never heard of a 'loopback filesystem' before. Can you expand a little on what this is?
It lets you mount a file as a filesystem, instead of an actual hardware device. I think it's called "loopback" because instead of reading from /dev/whatever it loops back to /dev/original and reads the specified file.
See the man page for `mount`: https://linux.die.net/man/8/mount (search for "loop")
The right term is a 'loopback device' which allows you to use a file on an existing filesystem as a block device.
Here's what the flow looks like:
open(/path/to/myfile) ->
ext4 driver ->
block operations on /dev/loop0 ->
open(/path/to/loop-file) ->
block operations on the data region of the file ->
btrfs driver ->
block operations on /dev/sda