weixin_39707725
weixin_39707725
2020-12-09 07:22

Create 4GB swapfile on external storage

Resolves #104

Bind mount /mnt/data/swap on external storage to /swap and create 4GB swapfile at /swap/swapfile.

该提问来源于开源项目:getumbrel/umbrel

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

7条回答

  • weixin_39707725 weixin_39707725 5月前

    I've tested this and it's working for me.

    You can test the entire update process with:

    
    sudo mkdir /umbrel
    sudo chown umbrel:umbrel /umbrel
    git clone --branch swap https://github.com/lukechilds/umbrel.git /umbrel
    sudo ~/umbrel/scripts/update/update --path /umbrel
    

    After the next reboot you should have a 4GB swap file at /swap/swapfile which is bind mounted to external storage and the dphys-swapfile dep should be removed.

    Do you think we should create the new swapfile on the fly after OTA update so users don't need to reboot to get access to swap?

    点赞 评论 复制链接分享
  • weixin_39907220 weixin_39907220 5月前

    The 4GB swap was created successfully with no problems in my testing! Although it looks like it didn't remove dphys-swapfile for some reason (hence the total swap size is 4.1G instead of 4.0G because of the existing 100mb swapfile):

    
    umbrel-testnet:~ $ free -h
                  total        used        free      shared  buff/cache   available
    Mem:          7.6Gi       881Mi       5.9Gi       8.0Mi       932Mi       6.7Gi
    Swap:         4.1Gi          0B       4.1Gi
    umbrel-testnet:~ $ dphys-swapfile
    Usage: /sbin/dphys-swapfile {setup|swapon|swapoff|uninstall}
    
    点赞 评论 复制链接分享
  • weixin_39707725 weixin_39707725 5月前

    Although it looks like it didn't remove dphys-swapfile for some reason

    Do you still have the dphys-swapfile binary available?

    点赞 评论 复制链接分享
  • weixin_39907220 weixin_39907220 5月前

    Yep, it looks like so:

    
    umbrel-testnet:~ $ dphys-swapfile
    Usage: /sbin/dphys-swapfile {setup|swapon|swapoff|uninstall}
    umbrel-testnet:~ $ ls /sbin/dphys-swapfile 
    /sbin/dphys-swapfile
    
    点赞 评论 复制链接分享
  • weixin_39907220 weixin_39907220 5月前

    Lol also didn't realize your branch was at v0.2.2. The update process changed my installation from v0.2.3 to v0.2.2. A good stress test regardless haha!

    点赞 评论 复制链接分享
  • weixin_39707725 weixin_39707725 5月前

    Lol also didn't realize your branch was at v0.2.2. The update process changed my installation from v0.2.3 to v0.2.2. A good stress test regardless haha!

    Oops, like like I forget to fetch upstream before I branched off.

    Yeah update --path does no version checks, it just blindly executes the update scripts. This is quite useful for dev so you can repeatedly re-install your branch over itself while testing.

    点赞 评论 复制链接分享
  • weixin_39707725 weixin_39707725 5月前

    I've made the suggested amendments.

    If you re-install based on this and make sure you remove swapfile/bindmount and re-install adn enable dphys-swapfile you should see everything is uninstalled/re-created after update.

    点赞 评论 复制链接分享

相关推荐