zoukankan      html  css  js  c++  java
  • MSYS2 瘦身小攻略(使用junction)

    MSYS2, 吃硬盘的大神

    MSYS2,集成了 x86 x64两个开发环境,且可以使用 pacman 进行包管理,可谓方便的很!可是,这个东东也有一个很不好的地方,就是实在太占硬盘。尽管下载的软件包一般最大也就几百兆,但这可是高压缩格式的,一旦展开,会像干燥剂喝了水一样泵长起来。以我的MSYS2文件夹为例子,安装了常用工具如 qt、boost、opencv、 fftw、Openscenegraph等后,已经35GB了。可怜我的C盘啊!

    初步瘦身

    初步瘦身有两个办法: 
    1. 删除pacman的下载包,位置在 varcachepacmanpkg 
    2. 删除不必要的软件包,比如 Qt 的静态版本。

    搬家

    如果不安装到C盘,有木有办法呢?那就重新安到E盘吧。我的D是光驱,于是,化了一天时间,挪到了D盘。注意了,这里有个解释,就是msys2的环境一旦安装后,是路径绑定的,他的 dll 都经过了patch。如果你把文件夹拷贝到别的位置,那是不行的,除非重新全部patch。由于我的网速快,就偷懒直接下载安装了。

    如何快速部署多台机器

    太高兴拉!压缩一下,给小组的机器全部都安装上吧!(⊙o⊙)…傻了,有的机器E盘是光驱。还有的机器,压根就一个C盘,这可如何是好!而且,无论怎样拷贝,35GB的体积都是太大了。无奈,如何是好?

    junction, windows下的 ln-s

    还好,对于熟悉运维的我来说,解决这个问题比较好办。 
    首先,对与文件夹绑定,不怕,有微软亲爹生的链接器 junction
    这个工具其实就是linux下用烂的ln -s, 他的介绍如下:

    Introduction
    
    Windows 2000 and higher supports directory symbolic links, where a directory serves as a symbolic link to another directory on the computer. For example, if the directory D:SYMLINK specified C:WINNTSYSTEM32 as its target, then an application accessing D:SYMLINKDRIVERS would in reality be accessing C:WINNTSYSTEM32DRIVERS. Directory symbolic links are known as NTFS junctions in Windows. Unfortunately, Windows comes with no tools for creating junctions—you have to purchase the Win2K Resource Kit, which comes with the linkd program for creating junctions. I therefore decided to write my own junction-creating tool: Junction. Junction not only allows you to create NTFS junctions, it allows you to see if files or directories are actually reparse points. Reparse points are the mechanism on which NTFS junctions are based, and they are used by Windows' Remote Storage Service (RSS), as well as volume mount points.
    
    Please read this Microsoft KB article for tips on using junctions.
    
    Notethat Windows does not support junctions to directories on remote shares.
    
    If you want to view reparse information, the usage for Junction is the following:
    
    
    Using Junction
    
    Use junction to list junctions:
    
    Usage: [-s]
    
    -s    Recurse subdirectories
    
    Examples:
    
    To determine if a file is a junction, specify the file name:
    
    junction c:	est
    
    To list junctions beneath a directory, include the –s switch:
    
    junction -s c:
    
    To create a junction c:Program-Files for "c:Program Files":
    
    C:>md Program-Files
    
    C:>junction c:Program-Files "c:Program Files"
    
    To delete a junction, use the –d switch:
    
    junction -d c:Program-Files

    有了这工具,随便把家搬到哪里,都可以连接到一个位置,那就是 C:msys64 (或c:msys32)

    NTFS压缩文件夹

    在以前,我使用winMount进行压缩、挂载。它曾经是一款很不错的软件,可以把带有压缩的文件挂载为虚拟磁盘。尽管中文版的已经停止开发了,但是百度一下还是可以找到支持win7以上版本的安装包。使用winMount 建立一个压缩盘,把msys文件夹全部拷入,而后挂载为Z:,使用 junction 进行连接,即可完成部署。 
    现在,直接利用NTFS磁盘的文件夹压缩,实现相同功能。方法是: 
    1. 在安装前,新建文件夹,改名为msys64之类的名字; 
    2. 右键单击文件夹,选择属性、高级,把压缩勾上; 
    3. 拷贝文件到该文件夹 
    4. 使用junction进行链接。 

    有了这些手段,MSYS2就更舒心如意啦!

    http://blog.csdn.net/goldenhawking/article/details/55105635

  • 相关阅读:
    jvm2-垃圾回收
    Elasticsearch脑裂问题详细分析以及解决方案
    ThreadLocal原理(基于jdk1.8)
    seata-分布式事务-学习笔记
    Java中的数组
    HAProxy 详细配置说明
    (基础)--- 约数
    (基础)--- Trie树
    Oracle 数据类型对比 不同数据类型对数据空间占用及查询效率影响
    python F score打分
  • 原文地址:https://www.cnblogs.com/findumars/p/6417824.html
Copyright © 2011-2022 走看看