15

I'm currently 'reorganizing' file structure within a RAIDZ1 volume. Moving directories from one dataset to another, which are both contained on the same volume.

SSH'ed into the machine and did a good old fashioned:

mv * destination

Shouldn't this be instantaneous? I understand it's spread across three drives, but at the same time, the files themselves don't really need to move - I just expected it to tweak the pointers for these files and be, well, basically instantaneous. It's definitely not. I have about 500G of data to move and it's been running for about half an hour now. o.O

Why isn't it near instant?

Specs: CPU: Intel G3220
MB: Gigabyte GA-B85-HD3
MEM: Kingston DDR3-1600 8GB
DISK: 3x2TB WD Green in RAIDZ1 volume

Ryan
  • 282
  • 2
  • 11

1 Answers1

23

You are thinking about things from the wrong level, is all.

If you move a file within the confines of a single ZFS dataset, it will react similarly to what you're expecting. If you move a file within the confines of a pool, but between datasets, it is a real move. Yes, technically the data just went from point A to point B and both points are on the same platters - but from ZFS' perspective, it moved houses.

ZFS datasets are separate filesystems. Real filesystems. They can have different block sizes, compression settings, etc. Moving a file between two ZFS filesystems, even on the same pool, is a real move - bits get read and then written again, as opposed to just updating a pointer.

Functionally it is roughly analogous to moving a file between two ext4 filesystems that are technically coming from 2 partitions of the same hard disk - the two filesystems, despite sharing underlying hardware, are logically disparate and so no 'pointer' change can happen, it must physically move the file, even though it's really only copying data from one location to another on the same underlying drive.

Nex7
  • 1,925
  • 11
  • 14