Date: Wed, 12 Dec 2001 17:22:03 +0100 From: Andrea Campi <andrea@webcom.it> To: Bakul Shah <bakul@bitblocks.com> Cc: freebsd-arch@FreeBSD.ORG Subject: Re: Real world Root Resizing (was Re: Proposed auto-sizing patch ... Message-ID: <20011212162203.GA9595@webcom.it> In-Reply-To: <200112092050.PAA26830@glatton.cnchost.com> References: <200112092050.PAA26830@glatton.cnchost.com>
next in thread | previous in thread | raw e-mail | index | archive | help
#include <std/disclaimer> I was able to simple boot to single user and growfs my / without any magic. I *might* have changed it to read-only just for safety but I don't think so. After that of course I rebooted immediately... Bye, Andrea On Sun, Dec 09, 2001 at 12:50:49PM -0800, Bakul Shah wrote: > Changing sysinstall helps new installations but doesn't help > existing systems with a "tiny" root fs -- something I had to > fix recently. I was surprised to see how easy it was! > > Here is the procedure I used, in case anyone else needs to do > the same. Assume ad0s1a is the root filesystem and ad0s1b is > the swap partition and its size is atleast new root fs size + > old root fs size. Do this as single user on a freshly booted > system. > > 1. disklabel ad0s1 > label # save a copy of the disklabel > 2. disklabel -e ad0s1 > if the new root size is N, change the b partition to start at offset N. > make its size the same as partition a and make its type 4.2BSD type. > 3. dd </dev/ad0s1a >/dev/ad0s1b bs=1m > 4. fsck /dev/ad0s1b > 5. echo 'boot_askname="YES"' >> /boot/loader.conf > 6. shutdown -r now > 7. boot in single user mode and when asked, choose the b partition as root. > 8. disklabel -e ad0s1 > change 'a' partition size to N. > 9. growfs -s N /dev/ad0s1a > 10. fsck /dev/ad0s1a # just to convince yourself everything is okay > 11. shutdown -r now > 12. boot in single user mode and when aske, choose the a partition as root. > 13. disklabel -e ad0s1 > restore the swap partition (to its new reduced size) > 14. remove the change to /boot/loader.conf made in step 5. > 15. reboot > > If there is an easier way, I'd like to hear about it. In > particular if / can be switched at runtime, all of this can > be done in one program without so many reboots. One can even > write a program to shuffle filesystems around to grow any fs > so long as there is some space somewhere! > > Disclaimer: use at your own risk. make backups and keep a > cleenex handy in case you screw up. make notes while doing > this to aid in debugging in case things go wrong. > > growfs should take an optional argument -A (for Auto :-) to > grow a fs to fill up the partition. growfs needs to be > renamed grow_ufs in case in future growfs is extended to grow > other fs types. Ditto for newfs, dumpfs, tunafish and so on. > > -- bakul > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-arch" in the body of the message -- Weird enough for government work. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011212162203.GA9595>