using hardlinks on windows instead of copying #71

Closed
springmeyer opened this Issue Sep 19, 2012 · 13 comments

Comments

Projects
None yet
1 participant
Contributor

springmeyer commented Sep 19, 2012

Since symlinks do not work on XP (or on systems where the user does not have the SeCreateSymbolicLinkPrivilege (basically not admin) we should consider hardlinks.

Hardlink pros:

  • much more efficient than falling back to copying
  • can be created by non-admin users
  • will work even if the linked file is moved

Cons:

  • Can only be created to files on the same volume (would make impossible or complicated mapbox/tilemill#1679)
  • wasteful/easily create cruft since they mean that the file will not be removed until all hardlinks are gone (so tilemill will silently hog drive space if users delete the source data and do not clean up their projects)
  • cannot be deleted if a process has them open (unlike symlinks) so we would need to re-instate the tileserver nuclear restart: mapbox/tilemill@bb785ab#models/Project.server.bones / mapbox/tilemill#1121 / mapbox/tilemill#1180
Contributor

springmeyer commented Sep 19, 2012

could be done like:

    } else if (e.code === 'EPERM') {
        if (env == 'development') {
            console.log("[millstone] detected platform that does not have permission to create symlinks, switching to copying data instead");
        }
        fs.symlink = fs.link;//file_linking_method = utils.copy;
    }
Contributor

springmeyer commented Sep 19, 2012

confirmed that hardlinks between files seem to work fine on windows XP.

Contributor

springmeyer commented Sep 19, 2012

not sure about updates however...

Contributor

springmeyer commented Sep 19, 2012

updating a csv seems to work on XP, loaded it into TileMill, kept open in notepad++, rendered map with it, then went back and edited a location. Re-saving in TileMill and the point was propertly re-rendered.

Contributor

springmeyer commented Sep 19, 2012

Also works for big rasters on Win XP - this is looking great.

springmeyer pushed a commit to tilemill-project/tilemill that referenced this issue Sep 21, 2012

reinstate bazooka yet again so win XP can delete projects (or any oth…
…er case where millstone falls back to hardlink or copy approach) - refs #1121, #1180 and tilemill-project/millstone#71

springmeyer pushed a commit that referenced this issue Sep 21, 2012

Contributor

springmeyer commented Sep 21, 2012

while hardlinks seem to work okay, I don't have the energy to properly test right now, and it seems wiser in that case to stick to a single fallback of copying to avoid having to debug too many combinations of windows misfortune. copying added in 1144f9b

Contributor

springmeyer commented Sep 21, 2012

closing. will dig this ticket back up if hardlink approach ever seems worthy to try as a replacement for copying.

@springmeyer springmeyer reopened this Sep 26, 2012

Contributor

springmeyer commented Sep 26, 2012

re-opening, looks like non-admin is way more common than I thought, so this copying fallback will hurt. Also, need to test hardlinks/symlinks/junctions and how they behave over networks (http://stackoverflow.com/questions/9042542/what-is-the-difference-between-ntfs-junction-points-and-symbolic-links) as per mapbox/tilemill#1679

Contributor

springmeyer commented Sep 27, 2012

also going to try using NSIS installer to grant the "createlink" permission: http://nsis.sourceforge.net/AccessControl_plug-in

Contributor

springmeyer commented Oct 9, 2012

yep, looks no possible to grant symlink privelage with nsis. And I only have win7 "home" so I can't use secpol.msc to mess with settings. fuuuuuu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment