Procedure for changing cache type

Because I’m using large files which are tens of gigabytes, I want to use hardlinks as my filesystem doesn’t support reflinks.
I executed the following commands

dvc config cache.type = hardlink
dvc config cache.protected = true
dvc checkout

However when I checked using ls -i the inodes of the file in .dvc/cache and the file in my working directory, they are still different.
Are there any further steps I need to take to get hardlinks to be used?

Also I noticed that both the file in the working directory and cache were still writable, when I thought that they should have been made read-only by using cache.protected = true
Is my understanding here mistaken?

I mistyped the commands above. I actually had executed them correctly, i.e.:

dvc config cache.type hardlink
dvc config cache.protected true
dvc checkout
1 Like

The right commands should NOT have a ‘=’, like this:

dvc config cache.type hardlink
dvc config cache.protected true

Then you can check the settings with cat .dvc/config. You should see something like this:

type = hardlink
protected = true

Thanks dashohoxha.

I’d actually mistyped the commands in my question but had correctly executed them. My config file is set exactly as you said it should be, but I still have the same probem of different inodes and writable files.
In addition I notice that files I added using dvc add after changing the configuration are using hardlinks and are read-only as expected, so I guess the question is how to apply the configuration to files added before the change.

I think dvc checkout does the trick. Maybe you forgot it

Thanks but unfortunately dvc checkout doesn’t work. I still have the same problem.

What about dvc checkout file.dvc ?

Nope, that doesn’t work either. I also tried pip install dvc --upgrade also just in case it was a problem but it’s still the same with the latest version (0.56.0)

I had a previous version of DVC and it seemed to work. Maybe it has changed recently.
Anyway, it seems to work like this:

dvc remove file.dvc
dvc checkout file.dvc
1 Like

Thank you. This worked!

More generic:

dvc status
dvc remove *.dvc
dvc status
dvc checkout *.dvc
dvc status

@dashohoxha Thanks for your answers!

@jcf76 It is a known bug in checkout, we have an issue for it in . We’ve addressed a similar issue in sequential dvc add(see link to PR in that issue) and will soon proceed with improving dvc checkout. Thanks for your feedback! :slightly_smiling_face: