From owner-freebsd-arch Wed Dec 12 8:22:13 2001 Delivered-To: freebsd-arch@freebsd.org Received: from hal-4.inet.it (hal-4.inet.it [213.92.5.23]) by hub.freebsd.org (Postfix) with ESMTP id 849F437B417 for ; Wed, 12 Dec 2001 08:22:08 -0800 (PST) Received: (from root@localhost) by hal-4.inet.it (8.11.1/8.11.1) id fBCGM7o263130 for ; Wed, 12 Dec 2001 17:22:07 +0100 Received: from acampi.inet.it(213.92.1.165) by hal-4.inet.it via I-SMTP-4.0.3-100 id s-213.92.1.165-lDUXUD; Wed Dec 12 17:22:07 2001 Received: from webcom.it (brian.inet.it [213.92.1.190]) by acampi.inet.it (Postfix) with SMTP id 2B9EA15533 for ; Wed, 12 Dec 2001 17:22:06 +0100 (CET) Received: (qmail 14862 invoked by uid 1000); 12 Dec 2001 16:22:04 -0000 Date: Wed, 12 Dec 2001 17:22:03 +0100 From: Andrea Campi To: Bakul Shah Cc: freebsd-arch@FreeBSD.ORG Subject: Re: Real world Root Resizing (was Re: Proposed auto-sizing patch ... Message-ID: <20011212162203.GA9595@webcom.it> References: <200112092050.PAA26830@glatton.cnchost.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200112092050.PAA26830@glatton.cnchost.com> User-Agent: Mutt/1.3.24i X-Echelon: BND CIA NSA Mossad KGB MI6 IRA detonator nuclear assault strike Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG #include 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/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