Copy files at the same folder to get better compression?

Status
Not open for further replies.

krantz

Dabbler
Joined
Jun 2, 2013
Messages
41
Hello all:

I have 4.7 TB volume with assorted files.

Now, I originally created this volume couple of years ago, with no compression option enabled.

After changing my server and successfully migrating the volume to the most updated zfs version, I changed compression level of the volume to LZ4, however files haven´t been reduced in size; I totally understand that I need to copy them again (already did a test with a large file, copied it out, then made a clone of it back to the volume and the size was smaller), I need to know how could I do this "copy-recopy" process a little faster, since the volume has thousands of files.

Thanks in advance!
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
The easiest way, create a dataset and throw them all inside the dataset. ;)

So if you have a folder called "files" on the root of the tank directory create a dataset called "files2" and copy them to the dataset. Then later rename the dataset to files. ;)
 

krantz

Dabbler
Joined
Jun 2, 2013
Messages
41
Yes but that would fill the disks -- I have a total of 6TB mirrored... I would have to copy and delete on the fly -- right?
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
mv will work as long as you are copying to a different dataset. (datasets are file system boundaries)
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
You could use rsync and the "remove-source-files" argument. Basically, you'd run something like "rsync -a --remove-source-files (source) (source-copy) && rm -rf (source) && mv (source-copy) (source)".

The advantage of this over just using "cp" or another dataset is that it will remove the files as they are copied. If you are worried about filling up your pool this should help avoid that issue. Just keep in mind that snapshots would still refer to the deleted data and take up space in the pool.
 
Status
Not open for further replies.
Top