The Story - How it begins
Recently there have been discussion in the EeeUser Forum about a slimmed down version of EeePC Linux or a barebone system. Many people like the F9 restore feature, but want to get rid of some programs they never use.I don't know how many people are interested in this, but after reading the posts, I am thinking it shouldn't be difficult based on the Boot Xandros from USB for Dummies approach I have been working on. I have seen lazyfai booting from USB and remove some installed programs with his early version of XEPC.org upgrade disc. The only tricky part is to resize the partition afterwards, but I have found a good tutorial on this: How To Resize ext3 Partitions without Losing Data.
Steps in my Original Plan
So after some moments of deep thinking, I think the steps we need to do are:- Boot up from a modified Asus EeePC USB Recovery disk
- Seek volume label to mount the recovery disk in /xan
- dd the P701L.gz recovery disk image to the 1st SSD
- Do the remaining operations as per the original bootscript
- Mount /dev/sda1 in /mnt
- chroot to /mnt and run apt-get to remove programs you listed in some text files "remove*.list"
- Run df to obtain the current System, Used and Available disk size
- Calculate the required new size of sda1 + say 5% margin
- umount /dev/sda1
- Perform disk scan with e2fsck to eliminate any filesystem errors
- Shrink the filesystem of sda1 to the calculated required new size with resize2fs
- Run e2fsck again to check and eliminate any filesystem errors
- Run fdisk to shrink the partition to the new size (make it slightly larger)
- Run resize2fs again to expand the filesystem to the partition (adjust for any size difference)
- Run fdisk again to expand the USER partition to fill up the free space
- Format the USER partition again and set the volume label USER
- End of operation: Reboot
- Need to let dpkg keep track of changes but dpkg database is spreading over sda1 and sda2
- Beware of new software installations by the user that have upgraded some newer versions of system libraries now residing in sda2 instead of in sda1.
- It is not possible to use resize2fs to move the starting disk cylinder of sda2. After you have shrinked sda1, there will be free disk space between sda1 and sda2.
My First Unsuccessful Trial
Last weekend, I proceed to test this out. The first part to remove programs with apt-get is successful. I ended up with 721 MB free disk space in sda1 (versus original 100 MB) after removing openoffice, acrobat reader, Chinese, all games and kids programs:remove_acroread.list 168 MB * Acrobat readerThe Used size as reported by df is now 1.5 GB (1513604 1K-blocks). I guess this is approaching the minimum size we can anticipate in sda1.
remove_drivers.list 9589 kB Additional hardware drivers
remove_games.list 58.9 MB Programs in PLAY tab / GAMES folder
remove_kids.list 70.5 MB Programs in LEARN tab
remove_ooo.list 301 MB # @ openoffice.org
remove_scim.list 20.9 MB Chinese Input Method
remove_zh_cn.list 41.7 MB * @ Simplified Chinese locales
remove_zh_tw.list 92.6 MB * # Traditional Chinese locales
Remark: Some zh_tw and zh_cn packages have been duplicated in above remove lists
* : include acroread-cn-tw 51.8 MB
# : include openoffice.org-help-zh-tw 27.9 MB
@ : include openoffice.org-help-zh-cn 27.9 MB
The Need to Defragment
Shrinking the partition however, out of my expectation, is not successful. It is not that it is not possible to shrink the partition with resize2fs, but I have overlooked the need to defragment the filesystem after deleting files belonging to the packages were removed. Although e2fsck is reporting only 0.5% non-contiguous, after resizing, e2fsck reported bad inode references.Currently there is no available reliable tool in Linux for defragmenting ext2 partitions, because unlike FAT and NTFS, there is rarely the need to defragment Linux ext2/ext3 filesystem. So I am now scratching my head to think it all over again how to get this done. Probably we will need to move all the files to /dev/sda2 and move it back again so as to allow the Linux kernel to automatically defragment them during this process.
Alternative Methods I have done in the Past
Another alternative is to give up on this disk resizing and just install programs into the free disk space of sda1. I have done this a number of times before with slightly different approaches:The first time, I boot up with no union filesystem (i.e. sda1 only) and upgrade programs from a local repositories based on xepc-upgrade-disc 20080525 . I have written the steps for how to set up a local repos and upgrade the system in this wiki: Upgrade factory OS with the xepc-upgrade-disc. The drawback of this method however, is that after the system boots up without union filesystem, it will write a lot of config and log files into /var, /home/user, etc. of sda1. These files won't be used again when you boot up normally with union filesystem, so just wasting disk space in sda1.
The second time, I tried to reproduce the same result, but working in rescue mode. The result of which is this wiki: Hacking in Rescue Mode. The operation is succesful. But one thing I didn't fully worked out is how to let dpkg keep track of the changes. I had to manually check, compare and copy files from the dpkg database in sda1 (/var/lib/dpkg) to sda2.
The third time, I tested upgrading with a read/write union filesystem as per this blog: Testing read/write union filesystem in my EeePC 4G. But again, this method has its own drawbacks.
So, now I come up with this idea to restore from USB to a barebone system which seems more sensible and more practical.
Continue:
Part II: Success - Restoring my EeePC from USB to a Minimal System
Part III: Re-installing Removed Packages to my minimal EeePC Linux 701 4G
Part IV: 2nd Test restoring to minimal with a 1.6.1 701 en iso
Part V: Yet another test with 1.6 French iso
Conclusion: Restore from USB to minimal system
No comments:
Post a Comment