xfs
[Top] [All Lists]

Re: migrating from internal to external logs

To: linux-xfs@xxxxxxxxxxx
Subject: Re: migrating from internal to external logs
From: Steve Lord <lord@xxxxxxx>
Date: Fri, 13 Jul 2001 12:18:54 -0500
In-reply-to: Message from Steve Lord <lord@sgi.com> of "Fri, 13 Jul 2001 11:19:56 CDT." <200107131619.f6DGJuw08383@jen.americas.sgi.com>
Sender: owner-linux-xfs@xxxxxxxxxxx
Of course the thing I missed is that if you run growfs to grow a log
it comes back and says:

xfs_growfs: log growth not supported yet

xfs_db also has some endian issues with the write command. I did however
manage to grow a log:

1. select your partition to become the log and dd a bunch of zeros over the
   complete range you want to be the log, so 32768 blocks would be:

   dd if=/dev/zero of=/dev/XXX bs=32768 count=4096

2. run xfs_db -x on the original unmounted filesystem use sb 0 to get to
   the super block.

3. reset the log offset using 

        write logstart 0

4. set the new log size using

        write logblocks xxxx

   where xxxx is the size in 4K blocks, xfs_db will come out with a new
   value which is different than this, feed this new value back into the
   same command and it will report the correct version. This is the endian
   conversion bug in xfs_db:

        xfs_db: write logblocks 32768
        logblocks = 8388608
        xfs_db: write logblocks 8388608
        logblocks = 32768

5. mount the filesystem using the logdev option to point at the new log:

         mount -t xfs -o logbufs=4,osyncisdsync,logdev=/dev/sda6 /dev/sda5 /xfs

You now have a filesystem with a new external log. Going back is harder since
you need to zero the old log and reset the logstart and logblocks fields.

It does occur to me that by using a different logstart than zero you could
put two external logs on the same partition, not sure what happens with
the device open close logic if you do this though.

Steve




> 
> I just came up with this sequence for moving a filesystem with a small
> internal log to one with a larger external log. I have not tested it, and you
> should not test it without using a dummy partition.
> 
> Steve
> 
> ------- Forwarded Message
> 
> Date:    Fri, 13 Jul 2001 11:15:25 -0500
> From:    Steve Lord <lord@xxxxxxx>
> To:      utz lehmann <xfs@xxxxxxxxxx>
> cc:      Steve Lord <lord@xxxxxxx>
> Subject: Re: benchmarks 
> 
> > Hi Steve
> > 
> > Steve Lord [lord@xxxxxxx] wrote:
> > > An external log is growable, an internal one unfortunately is not, and
> > > we keep kicking SGI support people who build multi-terabyte filesystems
> > > without reading the man page.
> > 
> > Is it possible to switch an existing filesystem from internal to external
> > log? And maybe back?
> > 
> > 
> > utz
> 
> You would need to format another partition with the correct log information,
> probably by using dd to get the original log out of the filesystem. Then
> take mount the filesystem with the mount option for the external log,
> then grow the log with xfs_growfs. In order to find the log on an existing
> filesystem do this:
> 
>  xfs_db /dev/hdc4
> xfs_db: sb 0
> xfs_db: print
> magicnum = 0x58465342
> blocksize = 4096
> dblocks = 1892898
> rblocks = 0
> rextents = 0
> uuid = 0cf3fdce-8924-40c1-8fb5-6a8a0f137caa
> logstart = 1048580
> rootino = 128
> rbmino = 129
> rsumino = 130
> rextsize = 16
> agblocks = 236613
> agcount = 8
> rbmblocks = 0
> logblocks = 4096
> versionnum = 0x2084
> sectsize = 512
> inodesize = 256
> inopblock = 16
> fname = "\000\000\000\000\000\000\000\000\000\000\000\000"
> blocklog = 12
> sectlog = 9
> inodelog = 8
> inopblog = 4
> agblklog = 18
> rextslog = 0
> inprogress = 0
> imax_pct = 25
> icount = 46080
> ifree = 231
> fdblocks = 1334163
> frextents = 0
> uquotino = 0
> gquotino = 0
> qflags = 0
> flags = 0
> shared_vn = 0
> inoalignmt = 2
> unit = 0
> width = 0
> dirblklog = 0
> 
> There is a logstart field in there and a logblocks, both are in filesystem
> block size units. You will need to modify the logstart field to zero before
> mounting the external log, for this you need the -x option on xfs_db to
> enable write mode. After printing out the superblock like this you would
> use this command:
> 
>       write logstart 0
> 
> To reset it.
> 
> I have not tested any of this, you should definitely not do it on a
> filesystem you really want to keep.
> 
> Going backwards would be possible, but you need to remember the original
> value for logstart and logblocks and reset them.
> 
> Steve
> 
> p.s. clean unmounts only, do not attempt this after a crash!
> 
> 
> ------- End of Forwarded Message



<Prev in Thread] Current Thread [Next in Thread>