0

I have Dropbox installed on a remote machine which I can only access via command line. The Dropbox folder installs by default to ~/, which is on a low-capacity SSD that holds my OS and programs. I would like to move the Dropbox folder to my internal HDD, /platter, which has enough capacity to hold all the files in my Dropbox. I can't figure out how to do this using only the command line/remote access.

I've tried moving the folder with mv ~/Dropbox /platter/Dropbox. It moves fine but won't sync. dropbox status only returns Dropbox isn't running! even though I can see the processes in htop. dropbox start runs some stuff that looks like it's starting (and I see things happening in the htop view of processes that have dropbox in them), but then dropbox status returns the same message -- Dropbox isn't running! It starts syncing again if I mv /platter/Dropbox ~/Dropbox, kill the running Dropbox processes, and re-run Dropbox start.

I've uninstalled and reinstalled using the headless install instructions here, but it still puts the Dropbox folder into ~/.

The instructions on the Dropbox website aren't super helpful because they assume access to the Dropbox GUI. I need something that can work via command line only since I only have remote access to the machine.

The other questions I've seen on here also seem to use the GUI. Is there a way to change where the folder is and get it to sync using only the command line/remote access?

The remote machine is running Ubuntu 18.04, Dropbox daemon version 140.3.1861, and Dropbox command-line interface version 2020.03.04.

5
  • I've added those details at the bottom. Commented Jan 8, 2022 at 6:54
  • Way back when I briefly used Dropbox, I remember trying to do this, finding no configurable way, and then using a bind mount of directory on my external HDD to ~/Dropbox. Worked well enough. Symlinks didn't work though. This was at least 5 years (probably more like 10) ago though
    – muru
    Commented Jan 8, 2022 at 8:05
  • Thanks! So if I follow correctly, it would be something like: 1. mv ~/Dropbox /platter/Dropbox; 2. mkdir ~/Dropbox; 3. mount --bind /platter/Dropbox ~/Dropbox ? My goal is to free up space on ~/, since I don't have enough storage there for a copy of my Dropbox. Commented Jan 8, 2022 at 11:24
  • Yes, that's about it. Only thing to add is a line in fstab to persist this across reboot.
    – muru
    Commented Jan 8, 2022 at 11:29
  • Ok, I'll try this. Would you mind making your comment an answer so I can accept it if it works? Commented Jan 8, 2022 at 11:30

3 Answers 3

1

I renamed ~/Dropbox to ~/hideDropbox

I had 2 drives as a RAID0, formatted ext4 so I plugged them in, then using Nautilus I looked for the RAID under +other locations and mounted it. Once it was mounted, I looked for it in the folder /media/d/ and found the raid's UUID Next, I used nano to edit /etc/fstab: sudo nano fstab and added a single line.

You see the first line beginning UUID, which has a device mounted as root. I simply copied it but put the UUID of the RAID in it and replaced the "/" with "/home/d/Dropbox"

When I rebooted, I copied everything from ~/hideDropbox into ~/Dropbox and the dropbox daemon sorted everything out. Of course I kept the original copy until I saw nothing was being lost. It's working great.

UUID=08d2d499-b12b-4e63-af8c-f60e2cb0a6ef / ext4 errors=remount-ro 0 1 UUID=d76fabc0-3ab6-4347-9ec2-ba8aadb3a1ae /home/d/Dropbox ext4 errors=remount-ro 0 1

0

Many years ago I used a bind mount to keep the Dropbox data on an external disk. (At the time the Dropbox application refused to work with symlinks, which might not be the case now.)

What I did was something like:

cp ~/Dropbox /media/data/Dropbox
echo /media/data/Dropbox ~/Dropbox bind bind | sudo tee -a /etc/fstab
sudo mount ~/Dropbox

(cp so that I wouldn't have to copy all the data back if it didn't work - we can always unmount and empty the directory once it's been found to work.)

5
  • Thanks for this suggestion and the code. I may be missing something, but it doesn't seem to be working for my needs. The bind links the folders as long as the directory is mounted and reflects the changes. But the changes are only reflected as long as ~/Dropbox is mounted. So I'm still constrained by the space on the SSD holding ~/Dropbox, and can't sync /platter/Dropbox once ~/Dropbox is unmounted. Commented Jan 9, 2022 at 5:40
  • @penGuinKeeper once you bind mount something on ~/Dropbox, that's constrained by the source of the bind mount.
    – muru
    Commented Jan 9, 2022 at 8:09
  • I see. I think I'm confused by the final line of your answer: "we can always unmount and empty the directory once it's been found to work." It seems like with this approach I would not be able to unmount ~/Dropbox -> empty ~/Dropbox -> sync /platter/Dropbox? Or am I missing something? Commented Jan 9, 2022 at 9:00
  • @penGuinKeeper what I mean is: once you verify everything runs fine with the bind mount, stop the sync, unmount ~/Dropbox, empty ~/Dropbox, bind mount ~/Dropbox again (just sudo mount ~/Dropbox would be enough if you added the fstab line from the answer), and start the sync again.
    – muru
    Commented Jan 12, 2022 at 9:19
  • Thanks @muru! As far as I can tell this seems to do exactly what I was after. Commented Jan 17, 2022 at 7:37
0

I don't know about drop boxes, but this works well with other directories like Documents and Downloads that it might work for you as well. Move your directory as planned, and then make a link back to the original location. Ubuntu should follow the link as if it wasn't moved.

This works on Windows as well as Linux, and everything follows the links.

3
  • Thanks! So if I follow correctly, it would be something like: 1. mv ~/Dropbox /platter/Dropbox; 2. mkdir ~/Dropbox; 2. ln /platter/Dropbox ~/Dropbox ? I'm assuming a hard rather than soft link? Commented Jan 8, 2022 at 11:30
  • I've done it in the terminal and in the Thunar file manager, which worked. I don't remember if it was hard or soft in the terminal, but I think it was hard.
    – Dark Moon
    Commented Jan 31, 2022 at 2:46
  • I've done it in the terminal and in the Thunar file manager, which worked. I don't remember if it was hard or soft in the terminal, but I think it was hard. The link goes where the "Dropbox" directory was after you moved it. The link is from the new location of where you put your directory at, on the other drive. So what happens is Dropbox would go to the link, and the link points to the new location of the Dropbox. This all can be done in the file manager. To make the link, hold down shift and ctrl keys, and then drag the directory from the new location to where you want the link.
    – Dark Moon
    Commented Jan 31, 2022 at 2:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .