Re: Moving existing internal journal log to an external device (success?)

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


On 2023-08-20 18:14, Dave Chinner wrote:
On Sun, Aug 20, 2023 at 03:37:38PM -0400, fk1xdcio@xxxxxxxx wrote:
Does this look like a sane method for moving an existing internal log to an
external device?

3 drives:
   /dev/nvme0n1p1  2GB  Journal mirror 0
   /dev/nvme1n1p1  2GB  Journal mirror 1
   /dev/sda1       16TB XFS

# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/nvme0n1p1
# mkfs.xfs /dev/sda1
# xfs_logprint -C journal.bin /dev/sda1
# cat journal.bin > /dev/md0
# xfs_db -x /dev/sda1

xfs_db> sb
xfs_db> write -d logstart 0
xfs_db> quit

# mount -o logdev=/dev/md0 /dev/sda1 /mnt

So you are physically moving the contents of the log whilst the
filesystem is unmounted and unchanging.


It seems to "work" and I tested with a whole bunch of data.

You'll get ENOSPC earlier than you think, because you just leaked
the old log space (needs to be marked free space). There might be
other issues, but you get to keep all the broken bits to yourself if
you find them.

It's 2GB out of terabytes so I don't really care about the space but the "other issues" is a problem.

You can probably fix that by running xfs_repair, but then....

I was also able
to move the log back to internal without issue (set logstart back to what it was originally). I don't know enough about how the filesystem layout works
to know if this will eventually break.

.... this won't work.

i.e. you can move the log back to the original position because you
didn't mark the space the old journal used as free, so the filesytem
still thinks it is in use by something....

The space being leaked is fine but xfs_repair is an issue. I did some testing and yes, if I run xfs_repair on one of these filesystems with a moved log it causes all sorts of problems. In fact it doesn't seem to work at all. Big problem.

*IF* this works, why can't xfs_growfs do it?

"Doctor, I can perform an amputation with a tornique and a chainsaw,
why can't you do that?"

Yes, I understand. I was thinking more of an offline utility for doing this but I see why that can't be done in growfs.

So I guess it doesn't really work. This is why I ask the experts. I'll keep experimenting because due to the requirements of needing to physically move disks around, being able to move the log back and forth from internal to external would be extremely helpful.


[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]

  Powered by Linux