From owner-freebsd-questions@FreeBSD.ORG Sun Nov 16 18:42:15 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8993116A4CE for ; Sun, 16 Nov 2003 18:42:15 -0800 (PST) Received: from idiom.com (idiom.com [216.240.32.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id D158C43F3F for ; Sun, 16 Nov 2003 18:42:14 -0800 (PST) (envelope-from muir@idiom.com) Received: from idiom.com (localhost [127.0.0.1]) by idiom.com (8.12.9p2/8.12.9) with ESMTP id hAH2gEdE076407 for ; Sun, 16 Nov 2003 18:42:14 -0800 (PST) (envelope-from muir@idiom.com) Received: (from muir@localhost) by idiom.com (8.12.9p2/8.12.9/Submit) id hAH2gE5G076406 for freebsd-questions@freebsd.org; Sun, 16 Nov 2003 18:42:14 -0800 (PST) (envelope-from muir) Date: Sun, 16 Nov 2003 18:42:14 -0800 (PST) From: David Muir Sharnoff Message-Id: <200311170242.hAH2gE5G076406@idiom.com> To: freebsd-questions@freebsd.org Subject: ccd recipe for extending a filesystem X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2003 02:42:15 -0000 Hi. I've come up with a recipe to grow a filesystem. I would like to do several things here: 1. Share the recipe so others can use it 2. Have someone verify my recipe -- I think it works, but another set of eyes would help 3. Ask if anyone knows a reason this won't work. Anyway... This is not for those who want clean systems or make mistakes when typing... To make a filesystem bigger (I'm assuming a normal filesystem here) like /foobar mounted on /dev/sd3d.... 1. make two new partitions. The first should be 32 blocks long (call it /dev/sd4e). The second should be the new space you want for your filesystem (16 blocks will be overhead) (call it /dev/sd4f) # disklabel -e sd4 2. zero the new small partion # dd if=/dev/zero of=/dev/sd4e 3. unmount the filesystem 4. capture the first 16 blocks of the filesystem: # dd if=/dev/sd3d of=/root/x count=16 5. make a ccd partition that spans the three partitions: # ccdconfg -c ccd2 0 none /dev/sd4e /dev/sd3d /dev/sd4f # disklabel -r -w ccd2c auto # disklabel ccd2c 6. back up the new disklabel # disklabel ccd2c > /root/y 7. restore the captured 16 blocks: # dd if=/root/x of=/dev/ccd2c 8. unfortunantly the last command clobbered the disk label. restore it: # disklabel -R -r ccd2c /root/y # disklabel ccd2c 9. fsck & mount the partition to make sure it's okay 10. # ccdconfig -g > /etc/ccd.conf 11. change /etc/fstab: /dev/sd3d becomes /dev/ccd2c 12. unmount the partition 13. use growfs to expandit 14. fsck & mount the partition to make sure it's okay I think making a backup first might be a good idea :-) If you are trying to grow a ccd partion that is set up like what you get after following the above instructions, it's eaiser but not as much easier as you might expect. 1. make the new partion for the addtional space (remember 16 blocks will be overhead). call it /dev/sd5h. # disklabel -e sd5 2. unmount the filesystem 3. capture the first 16 blocks of the filesystem: # dd if=/dev/ccd2c of=/root/x count=16 4. zero the original small partion # dd if=/dev/zero of=/dev/sd4e 5. make a ccd partition that spans all the partitions: # ccdconfg -c ccd2 0 none /dev/sd4e /dev/sd3d /dev/sd4f /dev/sd5h # disklabel -r -w ccd2c auto # disklabel ccd2c 6. back up the new disklabel # disklabel ccd2c > /root/y 7. restore the captured 16 blocks: # dd if=/root/x of=/dev/ccd2c 8. unfortunantly the last command clobbered the disk label. restore it: # disklabel -R -r ccd2c /root/y # disklabel ccd2c 9. fsck & mount the partition to make sure it's okay 10. ccdconfig -g > /etc/ccd.conf 11. unmount the partition 12. use growfs to expandit 13. fsck & mount the partition to make sure it's okay -Dave