Android 上的文件系统分区
我正在尝试在 Android 上重新分区 SDCard,并具有 root 访问权限。
我有 512 字节的 MBR 文件,它显示如下:
Pos MBRndx Type/Name Size Active Hide Start Sector Sectors --- ------ ---------- ---- ------ ---- ------------ ------------ 0 0 0C-FAT32X 5.9G No No 64 12,124,096 1 1 0C-FAT32X 1.9G No No 12,124,160 3,932,160
我想做的是将 5.9GB 分区大小调整为 3GB,然后用剩余空间创建一个 EXT 分区。我可以想到两种方法来做到这一点,但我对其中任何一种都有点困惑:
1)交叉编译 GNU Parted,并在 Android 上运行它以修改文件系统。这将是我的首选方法,但我一直在尝试使用 scrapbox 静态编译parted,但运气不佳,而且我也无法在 scrapbox 中动态编译 Android。
2)在我的电脑上使用一些实用程序直接修改512字节MBR,然后在Android上添加该文件。我有一个查看 MBR (mbrwiz) 的工具,但我不知道如何编辑它。
有人对其中一条或第三条路线有任何建议吗?
I'm trying to re-partition an SDCard on Android, with root access.
I have the 512 byte MBR file, and it shows up as this:
Pos MBRndx Type/Name Size Active Hide Start Sector Sectors --- ------ ---------- ---- ------ ---- ------------ ------------ 0 0 0C-FAT32X 5.9G No No 64 12,124,096 1 1 0C-FAT32X 1.9G No No 12,124,160 3,932,160
What I'm trying to do is resize the 5.9GB partition into 3GB, and then make an EXT partition with the remaining space. I can think of two ways to do this, but I'm a bit stumped in doing either of them:
1) Cross-compile GNU parted, and run it on Android to modify the filesystem in place. This would be my preferred method, but I've been trying to statically compile parted using scratchbox and haven't had much luck, and I haven't been able to dynamically compile for Android in scratchbox either.
2) Directly modify the 512 byte MBR using some utility on my computer, and then dd the file on Android. I have a tool to view the MBR (mbrwiz), but I don't know how to edit it.
Does anybody have any suggestions for either, or possibly a third route?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许我没有看到问题,但看起来您不想自动化此操作或制作具有该功能的程序。那么,为什么不将 SD 卡从 Android 设备中取出并在台式机上的读卡器中对其进行分区呢?您甚至可以事先进行完整备份,避免因分区而丢失任何数据。
Maybe I'm not seeing the problem, but it does not look like you want to automate this or make a program with that functionality. So, why not take the SD card out of the Android device and partition it in a card reader on your desktop machine? You could even do a full backup beforehand and avoid losing any data with the partitioning.
您可以使用 fdisk 而不是 pared,正如我们在后来的工具出现之前使用了多年的那样。
许多 Android 社区 rom 都包含基于 busybox 的 fdisk,您可以小心地安装它,而无需更换实际的 rom(可能还没有功能齐全的 Galaxy 版本)
不知道这如何帮助内核将其改回问题。您可以查看 /init.rc 并查看是否有一些可以注释掉的内容(您需要提取、修改和重新刷新 ramdisk 来对其进行更改,如果确实如此,则将其从内核中拆分并重新组合它与 htc 手机的方式相同)
当它处于 USB 安装模式时,也可以使用外部工具对其进行分区 - 如果 USB 存储设备只是将其视为一大堆块,那么您可能可以在其上放置一个分区表?
You could use fdisk instead of parted, as we used for years before the later tool came about.
Many of the android community roms include a busybox-based fdisk, which with care you could probably install without replacing the actual rom (which may not yet have a fully functional galaxy version)
Not sure how this helps the kernel changing it back problem. You could have a look in /init.rc and see if there's something you can comment out there (you would need to extract, modify, and reflash the ramdisk to make a change to that, splitting and recombining it from the kernel if they did it the same way as the htc phones)
It may also be possible to partition it with external tools when it's in usb mount mode - if the usb storage gadget just treats it as a sea of blocks, presumably you could put a partition table on it?