cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Create, upload, and share

Find help to solve issues with creating, uploading, and sharing files and folders in Dropbox. Get support and advice from the Dropbox Community.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dual booting with shared DB drive possible?

Dual booting with shared DB drive possible?

David C.118
Explorer | Level 4
Go to solution

I am looking in to buying a new laptop and will need to dual boot Windows and Ubuntu.  I am planning three SSD's - one for Windows, one for Ubuntu and one as a shared data drive.

Is it possible to set up DB so that both operating systems can sync to the shared data drive?  I have done a bit of research on here and I cannot seem to find a definitive answer.

 

Thanks!

28 Replies 28

BlackBat24
New member | Level 2
Go to solution

I'm in the same boat as chasDSO. I had been using only one NTFS data drive in my dualboot (win10, ubuntu 18.04 --originally 16.04) for a while now. I'm a PhD student and I run simulations in linux-based clusters, so it's easier to use ubuntu's command line tools, but there's a few things that are better done in windows. DB was one of my backup solutions, and my way of syncing my work (ubuntu), home (dual-boot) and laptop (ubuntu) computers.

I've tried ext2fsd on windows, and while I can read my drive, windows refuses to give me write permissions on an "insecure file system".

Short of duplicating my 1TB DB folder, I see no good solution to this.

David C.118
Explorer | Level 4
Go to solution

I had it working seamlesly, however, DB no longer supports NTFS under Linux and so this no longer works.

paloi
Explorer | Level 4
Go to solution

I feel the same pain. I have 170 Gb in my Dropbox, therefore I am a paying user.

Counting the Dropbox folder plus the .cache folder plus the DBs ..., goes beyond 200 Gb at my hard disk ...

It looks awkward and wasteful to have 200Gb in a windows partition and again another 200Gb in the Linux partition.

It is rather unaffordable, if you mostly work with laptops, and you expect to have fast SSD drives, as basically a 512 GB SSD which is not cheap will not be enough and then I will need a 1TB SSD drive which is quite expensive.

This thread started with someone trying to eliminate the duplication of the DB, and has evolved into confirming duplication of both, DB and files.

For me, this blow up the competitive advantage that Dropbox has over Google Drive and OneDrive, as until now they were performing quite poorly on Linux (to be gentle, because they do not have Linux client), ... so now this places Dropbox to some short of similar side, where it is only able to work in one of the two OS of my Dual boot laptops.

I can understand the complexity of this, and accept that the indexing is done every-time we switch of OS, and that in the worst case scenario the DB is duplicated ... but having several hundreds of GBs duplicated is not an option for me and most of the dual boot Dropbox clients  ...

TripleS
New member | Level 2
Go to solution

I'm using window 10 and ubuntu 18. I tried to use the same folder for windows and ubuntu however dropbox says: 

"To sync your dropbox move your drobox folder to partition with a compariable file system,.. Drop box is compariable with ext4" 

Since this thread is outdated, are there any updates? 

 

TripleS
New member | Level 2
Go to solution

@Здравко - thank you.  btw - who wrote this script? have you tested it? 

Здравко
Legendary | Level 20
Go to solution

The script part is entirely mine and C-code is derived from number other publications.

Ooo.. I didn't see the question for test! Yes, I currently use it. :slight_smile:

Здравко
Legendary | Level 20
Go to solution

@TripleS, Sorry, my last publication was one of my drafts. For sure it will not work. It was debug version (some syntax error was still there, missing punctuation). After install I didn't use it for long time (multiple versions was on same place). The next is the last actual version:

#!/bin/bash
##############################################################################
#                    Workaround for Dropbox daemon
#                    -----------------------------
# Verified on Dropbox v73.4.118
# Just make it executable (if need, using
#   $ chmod a+x fix_dropbox
# ) and run it.
# Author: Здравко
#   www.dropboxforum.com/t5/user/viewprofilepage/user-id/422790
##############################################################################

# Figure out the target places.
USR_HOME=`realpath ~`
USR_LOCAL="$USR_HOME/.local"
USR_LOCAL_BIN="$USR_LOCAL/bin"
USR_LOCAL_LIB="$USR_LOCAL/lib"
DRB_REPLACEMENT="$USR_LOCAL_BIN/dropbox"
DRB_FIX_LIB="$USR_LOCAL_LIB/libdropbox_ext4.so"
USR_PROFILE="$USR_HOME/.profile"

##############################################################################
# Precheck and fix up some prerequisites.

# Ensure target directories are on their place.
if [[ ! -d $USR_LOCAL_BIN ]]
then
  echo "The Directory \"$USR_LOCAL_BIN\" doesn't exist, going to create it."
  mkdir -p $USR_LOCAL_BIN
  if [[ $? -ne 0 || ! -d $USR_LOCAL_BIN ]]
  then
    echo "Directory \"$USR_LOCAL_BIN\" creation fail! Exit."
    exit 1
  fi
fi
if [[ ! -d $USR_LOCAL_LIB ]]
then
  echo "The Directory \"$USR_LOCAL_LIB\" doesn't exist, going to create it."
  mkdir -p $USR_LOCAL_LIB
  if [[ $? -ne 0 || ! -d $USR_LOCAL_LIB ]]
  then
    echo "Directory \"$USR_LOCAL_LIB\" creation fail! Exit."
    exit 1
  fi
fi

# Ensure backup for any existing files.
if [[ -e $DRB_REPLACEMENT ]]
then
  if [[ -f $DRB_REPLACEMENT ]]
  then
    echo "\"$DRB_REPLACEMENT\" already exist, going to back it up."
    mv --backup=t -T $DRB_REPLACEMENT "${DRB_REPLACEMENT}.backup"
    if [[ $? -ne 0 || -e $DRB_REPLACEMENT ]]
    then
      echo "Error backing up \"$DRB_REPLACEMENT\" file! Exit."
      exit 1
    fi
  else
    echo "$DRB_REPLACEMENT is not regular file! Exit."
    exit 1
  fi
fi
if [[ -e $DRB_FIX_LIB ]]
then
  if [[ -f $DRB_FIX_LIB ]]
  then
    echo "\"$DRB_FIX_LIB\" already exist, going to back it up."
    mv --backup=t -T $DRB_FIX_LIB "${DRB_FIX_LIB}.backup"
    if [[ $? -ne 0 || -e $DRB_FIX_LIB ]]
    then
      echo "Error backing up \"$DRB_FIX_LIB\" file! Exit."
      exit 1
    fi
  else
    echo "$DRB_FIX_LIB is not regular file! Exit."
    exit 1
  fi
fi

# Ensure writing permissions.
if [[ ! -w $USR_LOCAL_BIN || ! -x $USR_LOCAL_BIN ]]
then
  chmod u+rwx $USR_LOCAL_BIN
  if [[ $? -ne 0 ]]
  then
    echo "The Directory \"$USR_LOCAL_BIN\" is inaccessible! Exit."
    exit 1
  fi
fi
if [[ ! -w $USR_LOCAL_LIB || ! -x $USR_LOCAL_LIB ]]
then
  chmod u+rwx $USR_LOCAL_LIB
  if [[ $? -ne 0 ]]
  then
    echo "The Directory \"$USR_LOCAL_LIB\" is inaccessible! Exit."
    exit 1
  fi
fi

##############################################################################
# Generate actual workaround components.

# Fixer - source and building.
gcc -shared -fPIC -ldl -xc -o $DRB_FIX_LIB - << EndOfSrc
// Functions replacements
#define _GNU_SOURCE

#include <stdlib.h>
#include <sys/vfs.h>
#include <linux/magic.h>
#include <dlfcn.h>
#include <sys/statvfs.h>
#include <stdarg.h>

static int (*orig_statfs)(const char *path, struct statfs *buf) = NULL;
static int (*orig_statfs64)(const char *path, struct statfs64 *buf) = NULL;
static int (*orig_open64)(const char *pathname, int flags, ...) = NULL;

int statfs(const char *path, struct statfs *buf) {
  if (orig_statfs == NULL) {
    orig_statfs = dlsym(RTLD_NEXT, "statfs");
  }
  register int retval = orig_statfs(path, buf);
  if (retval == 0) {
    buf->f_type = EXT4_SUPER_MAGIC;
  }
  return retval;
}
 
int statfs64(const char *path, struct statfs64 *buf) {
  if (orig_statfs64 == NULL) {
    orig_statfs64 = dlsym(RTLD_NEXT, "statfs64");
  }
  register int retval = orig_statfs64(path, buf);
  if (retval == 0) {
    buf->f_type = EXT4_SUPER_MAGIC;
  }
  return retval;
}

int open64(const char *pathname, int flags, ...) {
  if (orig_open64 == NULL) {
    orig_open64 = dlsym(RTLD_NEXT, "open64");
  }
  register const char *p0 = "/proc/filesystems", *p1 = pathname;
  while(*p0 && *p1 && *p0 == *p1) ++p0, ++p1;
  if (*p0 == '\0' && *p1 == '\0') {
    return -1;
  }
  va_list arg;
  va_start(arg, flags);
  mode_t mode = va_arg (arg, int);
  va_end(arg);
  return orig_open64(pathname, flags, mode);
}
EndOfSrc
if [[ $? -ne 0 ]]
then
  echo "Error building \"$DRB_FIX_LIB\"! Exit."
  exit 2
fi
echo "\"$DRB_FIX_LIB\" - build and ready."

# Wrapper generating.
cat > $DRB_REPLACEMENT << WrapperHead
#!/bin/bash
if [ \$1 == "start" ]
then
  sleep 1
  patchpath=\`which \$0\`
  if echo \$(for i in \`ps -C dropbox -o pid\`
            do ls -l /proc/\$i/exe 2>/dev/null | grep -v \$patchpath
            done) | grep dropbox > /dev/null
  then
    timeout=300
    # Make sure there isn't any concurrent start operation in progress.
    /usr/bin/dropbox running
    while [[ \$? -eq 0 && \$timeout -ne 0 ]]
    do
      sleep 1
      ((--timeout))
      if echo \$(for i in \`ps -C dropbox -o pid\`
                do ls -l /proc/\$i/exe 2>/dev/null | grep -v \$patchpath
                done) | grep dropbox > /dev/null
      then
        /usr/bin/dropbox running
      fi
    done
    # If there is running application instance, force its stop.
    /usr/bin/dropbox running
    while [[ \$? -ne 0 && \$timeout -ne 0 ]]
    do
      /usr/bin/dropbox stop
      sleep 1
      ((--timeout))
      /usr/bin/dropbox running
    done
    # If something goes wrong...
    if [[ \$timeout -eq 0 ]]
    then
      # ...notify somehow about.
      title="Problem launching Dropbox"
      mainmsg="Possible existing application instance dead"
      submsg="Check that, clear and try start again"
      if which notify-send > /dev/null
      then notify-send --icon=dropbox "\$title" "<b>\$mainmsg\!</b>\n\$submsg."
      elif which zenity > /dev/null
      then zenity --error --title="\$title" --timeout=10 --width=380 \\
        --text="<span size=\"xx-large\"><b>\$mainmsg\!</b>\n\$submsg.</span>" \\
        2> /dev/null
      else echo "  \$title!"
        echo "\$mainmsg."
        echo "\$submsg."
      fi
      exit 1
    fi
  fi
fi
WrapperHead
declare -p | grep "declare -x LD_PRELOAD" > /dev/null
if [[ $? -ne 0 ]]
then
  echo "export LD_PRELOAD=$DRB_FIX_LIB" >> $DRB_REPLACEMENT
else
  echo "LD_PRELOAD=$DRB_FIX_LIB:\$LD_PRELOAD" >> $DRB_REPLACEMENT
fi
echo "/usr/bin/dropbox \$@" >> $DRB_REPLACEMENT
chmod a+x $DRB_REPLACEMENT
echo "\"$DRB_REPLACEMENT\" - generated."

# Environment check and fixup (if need).
echo ""
echo ""
(
IFS=:
for a in $PATH
do
  if [[ "$a" == "$USR_LOCAL_BIN" ]]
  then
    exit 0
  elif [[ "$a" == "/usr/bin" ]]
  then
    break
  fi
done
exit 1
)
if [[ $? -ne 0 ]]
then
  echo "" >> $USR_PROFILE
  echo "" >> $USR_PROFILE
  echo "# Add $USR_LOCAL_BIN to \$PATH environment variable." >> $USR_PROFILE
  echo "# This addition is dedicated for Dropbox Workaround." >> $USR_PROFILE
  echo "# Remove theses lines when they are no more needed." >> $USR_PROFILE
  echo "PATH=\"$USR_LOCAL_BIN:\$PATH\"" >> $USR_PROFILE
  echo "" >> $USR_PROFILE
  echo "Your Dropbox is almost patched. You have to logout and login"
  echo " (or on Your opinion - restart), so all changes to take effect."
  echo "After Your next account login:"
fi
echo "Your Dropbox is already patched. Just start it from desktop GUI or type:"
echo "\$ dropbox start"
echo "in console."

paloi
Explorer | Level 4
Go to solution

@Здравко Thanks for your posting, it looks like a new hope after so many months.

Could you please confirm what the script does?

Not only the workarround to have the Dropbox only once over the NTFS locations, but also a single DB which avoids reindexing every time one boots with the other OS, plus support for selective sync?

Здравко
Legendary | Level 20
Go to solution

Hi @paloi, Yes, I reinstall it just to be sure (after detecting that the last publication wasn't the recent). Exact function is: mask the underlying filesystem, so for Dropbox it looks like Ext4 (doesn't matter what is realy). The change is only how it looks like, there are no any actual changes in real filesystem.

Здравко
Legendary | Level 20
Go to solution

I don't use selective sync, so this is not tested.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    sharky_pi Explorer | Level 3
  • User avatar
    QA New member | Level 2
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    Rich Super User II
What do Dropbox user levels mean?