Repository navigation
数据盘分成自动扩盘和指定大小两种,默认自动扩盘 - #132
Merged
Merged
Conversation
数据盘镜像是稀疏的,所以与其快满了下次开机再加 16 GB,不如一开始就把 盘设到 256 GB:宿主只为实际写进去的数据付空间,客体里一直有剩余,不用 等开关机。64 GB 扩到 256 GB 宿主一次性多约 1 GB(新块组的 inode 表)。 - mas-avd.json 的 instances.<i>.dataDiskMode 记模式(auto / manual, 没写就是 auto);大小照旧在 config.ini 的 disk.dataPartition.size, AUTO-MAS 读的字段不变。 - 新建不给大小就是自动扩盘(256 GB);给了是指定大小。没写模式的旧实例 下次开机前经 avd.Update 扩到 256 GB,开机后 growData 在线扩文件系统; 0.36 以前 16 GB 以下老盘扩不满的报法照旧。 - 指定大小的盘快满时(开机后读 /data,剩余不到 5 GB 或 10%)在 status / info / 卡片提醒,带改大或改成自动扩盘的命令;自动扩盘的实例 在宿主盘剩余不到 20 GB 时提醒。info 显示数据盘在宿主上实际占多少。 - CLI:create / set 的 --data-gb auto|N;撤掉还没发版的 --auto-grow 和 「快满了下次开机加 16 GB」那一套。MCP update_instance 加 data_disk_auto,管理器新建和设置里二选一,选指定大小才有大小框。 - README、API.md 中英两份跟着改。 Refs ModAVD/ModAVD#153
# Conflicts: # README.en.md # README.md # internal/cli/commands.go # internal/cli/format.go # internal/emu/crud.go # internal/emu/status.go # internal/emu/types.go # internal/ui/API.en.md # internal/ui/API.md # internal/ui/handlers.go # internal/ui/web/dev/mock.js # internal/ui/web/js/forms.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
为什么
#130 做的是「快满了下次开机加 16 GB」。数据盘镜像是稀疏的,用户改了做法:一开始就把盘设大,宿主只为实际写进去的数据付空间,客体里一直有剩余,不用等开关机(ModAVD/ModAVD#153)。实例给两种:自动扩盘(默认)和指定大小。
核过宿主侧的代价:一台 64 GB 的实例扩到 256 GB、开机约 2 分钟再关机,
userdata-qemu.img.qcow2从 1.46 GB 到 2.43 GB,多约 0.97 GB(含这次开机自己的写入)。多出来的主要是新块组的 inode 表(每 128 MB 块组 512 KB,约 0.4%),扩完以后 ext4lazyinit 在后台几分钟内写完。之后只按实际写入增长。改了什么
mas-avd.json的instances.<i>.dataDiskMode记auto/manual,没写就是auto。大小照旧在config.ini的disk.dataPartition.size(AUTO-MAS 读这个字段,格式不变,256 在它校验的 16–512 范围内)。auto。prepareLaunch)经avd.Update扩到 256 GB,模拟器开机时扩镜像,开机后growData在线扩文件系统,和set --data-gb同一套;0.36 以前 16 GB 以下老盘扩不满,照旧报。/data的剩余,记在instances.<i>.dataSpace。读数属于当前大小、剩余不到 5 GB 或 10% 时,在status、info、管理器卡片提醒,带改大或改成自动扩盘的命令;自动扩盘到了 256 GB 还快满,建议改成指定大小(最大 512)。info显示数据盘在宿主上实际占多少(data_space.host_bytes)。create/set的--data-gb auto|N。撤掉 数据盘快满时下次开机前自动扩容 #130 加的、还没发版的--auto-grow和dataAutoGrow,以及「快满了加 16 GB」、宿主盘护栏那一套,不留两套。create_instance不给data_partition_gb就是自动扩盘;update_instance和PATCH /api/instances/{i}加data_disk_auto。internal/ui/API.md中英两份;dev/mock.js跟着改。avd/testdata/instances_ref.py(AUTO-MAS 逻辑的参照)记下默认 256 GB 和dataDiskMode这两处有意的不同。测试
mas-avd.json里别的键不丢;状态文字和命令;CLI--data-gb auto|N解析和输出。<=、取反)。>=改>、手动也扩、读不到也扩、开机前从不扩)。<=、手动也提醒、读不到算不够)。go test ./...、go vet(Windows、GOOS=darwin、GOOS=linux)、gofmt、隐私扫描、scripts/*.mjs全部通过。管理器新建对话框和设置抽屉用 mock 点过:切换模式时大小框显示和隐藏,切到指定大小时保存按钮亮起。发版回归要测的场景:
info是「自动扩盘(256 GB)」,宿主占用和 64 GB 的新实例差不多(多约 1 GB 以内);装一个游戏后宿主占用只涨实际写入的量。mas-avd.json没有dataDiskMode):升级后开机前扩到 256 GB,开机后在线扩文件系统,游戏数据还在、能正常进游戏;再开一次机不再扩。dataDiskMode是manual;把/data压到剩余 5 GB 以下(fallocate一个大文件),关机再开机后卡片和status提醒快满,带--data-gb auto和改大的命令。mas-avd.json后dataDiskMode、dataSpace还在,AUTO-MAS 里显示的数据盘大小正常(256)。Refs ModAVD/ModAVD#153