input-output-hk / daedalus

The open source cryptocurrency wallet for ada, built to grow with the community
https://daedaluswallet.io/
Apache License 2.0
1.23k stars 297 forks source link

How do I change the storage directory? #605

Closed Prillan closed 2 years ago

Prillan commented 6 years ago

I don't want it to consume my remaining disk space on my SSD, how can I change the storage directory to something other than %APPDATA%?

This is actually preventing me from trying Cardano.

greg-fischer commented 3 years ago

OK! Solved!

First note though, ZFS isn't the issue. It was working on ZFS on another system, I realized later.

The problem is that there's two different scripts that start Daedalus! One CLI, another for applications menu. When I run the application from the Ubuntu menu it was ignoring what I put in ~/.local/bin/daedalus-mainnet. Now that I've slept a bit, it occurred to me to run that script from the CLI directly, which worked and used my /home-ext/greg/daedalus folder. So then I realized, "OK, what's the menu launcher running then?" A totally different launcher script of course. I should have questioned this before.

My desktop menu launcher is in this file: ~/.local/share/applications/Daedalus-mainnet.desktop

In there it shows the Exec line to the script to launch Daedalus: /home/greg/.local/share/Daedalus/mainnet/namespaceHelper

That script appears to be the same as ~/.local/bin/daedalus-mainnet script. I changed the -m /home:/home to match my folder and now it works. I don't think there's a need for symlinking with this method.

This brings up another issue though. It looks like changing this -m option runs the entire wallet from the new location. This is not what I'd prefer. It's ok for now, solved my immediate problem. However, I want my wallet in my $HOME and the massive public blockchain somewhere else. IMO, it would be best to symlink the "chain" folder elsewhere, but something in Nix or maybe the Daedalus app itself thinks /tmp is a better idea. Actually, this really should be in the software as a configurable option, or config file at the very least.

I also want to point out all these blockchain wallets storing a copy of the chain in users $HOME's is horrible. I'll have over 30G of public blockchain data that's pointless to backup between a few wallets. User's typically want to backup their home folder, and if most people run backups with this configuration, that's a huge waste of resources. Especially if one backs up to cloud... what a waste of time, bandwidth, and storage.

CantTouchDis commented 3 years ago

ok good to know.

I agree with you as I mentioned above

I would just use that as a workaround for now until there is an option to store the chain in a separate directory

An option to change the chain directory would be a nice addition

ghosty111 commented 3 years ago

Almost 4 years and no change how about that ....

InderKumarRathore commented 3 years ago

@ghosty111 if you read the comments you will find the solution to do it, it's not convenient but it works. I hope after smart contract they have the bandwidth to do it.

nikolaglumac commented 3 years ago

Almost 4 years and no change how about that ....

Sorry to disappoint you... As @InderKumarRathore mentioned - we hope to get to this once Alonzo work is done. Thanks for the patience! 🙏

melroy89 commented 3 years ago

Thanks for rolling-out smart contracts rather soon than later on the mainnet, so you can update Daedalus with those must needed features indeed!

ancoron commented 2 years ago

Here is my take on it (a bit more generic). I just modified the ~/.local/bin/daedalus-mainnet script into this:

#!/usr/bin/env bash

set -e

cd ~/.daedalus/
mkdir -p etc
cat /etc/hosts > etc/hosts
cat /etc/nsswitch.conf > etc/nsswitch.conf
cat /etc/localtime > etc/localtime
cat /etc/machine-id > etc/machine-id
cat /etc/resolv.conf > etc/resolv.conf

nix_opts=()

if [ -d "${DAEDALUS_DIR}" ]; then
    # mount custom data dir
    nix_opts+=(-m "${DAEDALUS_DIR}:${HOME}/.local/share/Daedalus")
fi

if [ "x$DEBUG_SHELL" == x ]; then
  exec ./nix/store/s74k20bgs8bm8267mifzxsmkgm2n94hb-nix-user-chroot-2c52b5f/bin/nix-user-chroot -n ./nix -c -e -m /home:/home -m /etc:/host-etc -m etc:/etc "${nix_opts[@]}" -p DISPLAY -p HOME -p XAUTHORITY -p LANG -p LANGUAGE -p LC_ALL -p LC_MESSAGES -- /nix/var/nix/profiles/profile-mainnet/bin/enter-phase2 daedalus
else
  exec ./nix/store/s74k20bgs8bm8267mifzxsmkgm2n94hb-nix-user-chroot-2c52b5f/bin/nix-user-chroot -n ./nix -c -e -m /home:/home -m /etc:/host-etc -m etc:/etc "${nix_opts[@]}" -p DISPLAY -p HOME -p XAUTHORITY -p LANG -p LANGUAGE -p LC_ALL -p LC_MESSAGES -- /nix/var/nix/profiles/profile-mainnet/bin/enter-phase2 bash
fi

Now, the only thing that needs to be set is the environment variable DAEDALUS_DIR (which is also used inside the nix chroot, but will not collide here). So I have this in my ~/.profile:

DAEDALUS_DIR=/mnt/archive/daedalus
export DAEDALUS_DIR

...and the contents of that directory is:

└── mainnet
    ├── chain
    │   ├── immutable
    │   ├── ledger
    │   └── volatile
    ├── Logs
    │   └── pub
    ├── Secrets
    ├── tls
    │   ├── client
    │   └── server
    └── wallets

(so not a full home directory, only the data)

It would be very easy to just add such a workaround (until a more appropriate solution is implemented) to the generated script:

melroy89 commented 2 years ago

Here is my take on it (a bit more generic). I just modified the ~/.local/bin/daedalus-mainnet script into this:

Hopefully something like this can be merged upstream. So it's at least way better then now.

cleverca22 commented 2 years ago

any changes you do to the script will undo at the next update

my personal preference is symlinks:

[clever@amd-nixos:~/.local/share/Daedalus]$ ls -lh
total 29K
lrwxrwxrwx 1 clever users 27 Mar 29  2018 mainnet -> /home/clever/dedup/mainnet/

that will persist between updates, and seamlessly redirect everything

ancoron commented 2 years ago

@cleverca22 Symlinking only works in your case because you kept everything under /home. Just look at the bind mount options that the standard version is doing in that start script (/home and /etc). So it simply can't work for other locations outside of those two directories (also: the symlink will be there, but Daedalus will not be able to follow it, since the nix chroot doesn't allow that.

cleverca22 commented 2 years ago

ah yeah, the chroot complicates matters, anywhere you move it must still be accessible

user1n commented 2 years ago

Came here only to post this https://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html#hardlinks Hoping it helps some of you as it has me.

melroy89 commented 2 years ago

Soft-links and hard-links are all a very bad workaround IMO.

Why can't I easily change the Daedalus storage location in the GUI? After 5 years!!

melroy89 commented 2 years ago

@danielmain Can this feature be planned in any upcoming releases?

This missing feature is hampering me to use a good decentralized Cardano wallet on my PC (no web-wallets).

user1n commented 2 years ago

@danger89 I am not sure why it is a very bad workaround. Quite frankly all I know is that it is the simplest and most elegant solution, that I have found and most importantly of all it is one that achieves something that has been on thread for 5 years with no native solution on the horizon. So to each their own. This is persistent across version updates and I dont have to worry about a 60GB+ growing dir in my app data.

KIVassilev commented 2 years ago

You have multiple options now. If you dont need to run a full node, you can simply switch to one of the light wallets: I do want to run a full node, just not on my system drive.

melroy89 commented 2 years ago

with no native solution on the horizon

Yea so this bothers me quite a bit. I looks like there is no focus on Daedalus wallet for the past years as you mentioned. Cardano project is now even focusing in creating their own light wallet. Which is fine as well, but IMO Cardano project/IOHK should definitely focus on Daedalus. Especially on the usability side, like this kind of issues.

EDIT: @nikolaglumac Alonzo fork is already done for a year. Maybe plan this item after the Vasil fork? Or what is your suggestion?

danielmain commented 2 years ago

@danielmain Can this feature be planned in any upcoming releases?

This missing feature is hampering me to use a good decentralized Cardano wallet on my PC (no web-wallets).

Yea so this bothers me quite a bit. I looks like there is no focus on Daedalus wallet for the past years as you mentioned. Cardano project is now even focusing in creating their own light wallet. Which is fine as well, but IMO Cardano project/IOHK should definitely focus on Daedalus. Especially on the usability side, like this kind of issues.

@danger89 I created a task for this in our backlog. If our product owner thinks that this a high requested feature, I can imagine creating a PR for it.

danielmain commented 2 years ago

Our PO set this as low priority because we have a great workaround described here: https://iohk.zendesk.com/hc/en-us/articles/900004340586-How-to-symlink-Daedalus-chain-folder

Actually my chain folder is in my NAS on my home network and Daedalus works perfectly:

CleanShot 2022-07-11 at 21 40 18@2x

We might create some option to let users move the chain folder somewhere else but not now.

tbidne commented 2 years ago

We might create some option to let users move the chain folder somewhere else but not now.

Then why close the issue? I don't think a workaround that requires users to:

  1. Google something like "daedalus install directory" and hopefully find this issue or that blog post.
  2. Create permanent symlinks.

for a feature as fundamental as "choose where 10s of GB of data is stored" qualifies as "great". It is more of an adequate stopgap, imo.

danielmain commented 2 years ago

@tbidne, we have an internal JIRA ticket in our backlog with low priority so that we will not forget it :)

image

As soon we start with the implementation I will parte the PR link so you can track it.

Google something like "daedalus install directory" and hopefully find this issue or that blog post. Well seems easy to find it:

image image

Create permanent symlinks. What do you mean by permanent? symlinks stay as long you do not delete them

@tbidne trust me is not that we don't want to implement it. However, we are very busy with other vital features that are more important than this one. I hope you understand.

tbidne commented 2 years ago

@danielmain Thanks, I appreciate the quick response and transparency. It is your right to determine how to best fit github issues into your workflow.

By "permanent symlinks", I meant manually created symlinks that are meant to live indefinitely. Of course there is no technical reason why a symlink cannot live forever, but I prefer to avoid creating my own as it is one more imperative step I have to remember if I ever have to redo anything (cf. declarative configs like nix or an explicit "choose build dir" option in the settings).

melroy89 commented 2 years ago

Also keep in mind that if you already created a symlink before the Daedalus installation (executing: daedalus-x.x.x-mainnet-x.bin). You will get an error:

+ test -z ''
+ XDG_DATA_HOME=/home/melroy/.local/share
+ export DAEDALUS_DIR=/home/melroy/.local/share/Daedalus/mainnet
+ DAEDALUS_DIR=/home/melroy/.local/share/Daedalus/mainnet
+ mkdir -pv /home/melroy/.local/share/Daedalus/mainnet/Logs/pub
mkdir: cannot create directory '/home/melroy/.local/share/Daedalus/mainnet': File exists

Also changing the folder to a symlink, after the Daedalus installation, will result into issue with starting Daedalus:

mkdir: cannot create directory '/home/melroy/.local/share/Daedalus/mainnet': File exists
mkdir: cannot create directory '/home/melroy/.local/share/Daedalus/mainnet': File exists

Please consider reopening this issue. Since it's still relevant and needs to be fixed!!

So I'm forced to only change the folder chain.