tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: growfs(8) for NetBSD



On Fri, 28 Mar 2008 00:50:10 +0100
Juan RP <xtraeme%gmail.com@localhost> wrote:

> Hey,
> 
> I've just adapted growfs(8) from OpenBSD (they adapted the FreeBSD code),
> which is able to grow FFSv1 and FFSv2 filesystems.
> 
> I tested growing a partition in FFSv1 and FFSv2 from 1GB to 4GB and the
> process was smooth (and fast); after this I ran 'fsck_ffs -yf /fs' and it
> found one error that was fixed correctly.
> 
> I didn't find any error, so I'd think it should be safe to use it
> everywhere. Also please note that I only tried it on i386, perhaps it needs
> changes for BE and/or LP64 archs.
> 
> http://www.netbsd.org/~xtraeme/growfs-20080328.tar.gz
> 
> Please review and/or test it, thanks!

I tried it on sparc64. Grew a 3GB FFSv2 populated with 200MB of data to
12GB. Seems to have worked for the most part, except I also got one fsck
error:

SUMMARY INFORMATION BAD
SALVAGE? yes
BLK(S) MISSING IN BIT MAPS
SALVAGE? yes

It also needed the attached diff to compile on LP64.
(Looks good, now I only need a tool that can add more components into an
existing raidframe RAID5 set!)

Cheers,
-Tobias
--- growfs.c.orig       2008-03-28 01:01:46.000000000 +0100
+++ growfs.c    2008-03-28 01:05:59.000000000 +0100
@@ -257,7 +257,7 @@
                initcg(cylno, utime, fso, Nflag);
                if (quiet)
                        continue;
-               j = snprintf(tmpbuf, sizeof(tmpbuf), " %lld%s",
+               j = snprintf(tmpbuf, sizeof(tmpbuf), " %" PRId64 "%s",
                    fsbtodb(&sblock, cgsblock(&sblock, cylno)),
                    cylno < (sblock.fs_ncg - 1) ? "," : "");
                if (j >= sizeof(tmpbuf))
@@ -1097,7 +1097,7 @@
                for (d = rounddown(d, sblock.fs_frag); d >= osblock.fs_csaddr;
                    d -= sblock.fs_frag) {
                        DBG_TRC;
-                       DBG_PRINT1("d=%lld\n", d);
+                       DBG_PRINT1("d=% " PRId64 "\n", d);
                        setblock(&sblock, cg_blksfree(&acg, 0),
                            (d % sblock.fs_fpg) / sblock.fs_frag);
                        acg.cg_cs.cs_nbfree++;
@@ -2322,7 +2322,7 @@
                DBG_LEAVE;
                return; /* skip empty swiss cheesy file or old fastlink */
        }
-       DBG_PRINT2("scg checking inode (%lld in %d)\n", in, cg);
+       DBG_PRINT2("scg checking inode (%" PRId64 " in %d)\n", in, cg);
 
        /*
         * Check all the blocks.


Home | Main Index | Thread Index | Old Index