Date: Sun, 16 Nov 2003 18:42:14 -0800 (PST) From: David Muir Sharnoff <muir@idiom.com> To: freebsd-questions@freebsd.org Subject: ccd recipe for extending a filesystem Message-ID: <200311170242.hAH2gE5G076406@idiom.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311170242.hAH2gE5G076406>