Thursday, October 15, 2009

[Level 2] File ACL...


Someone ask me about how to "Copy/Backup files with acl", there are several ways to do so.
1. use cp -p command:
# cp -p ./a.txt ./b.txt
PS.
If you copy a file from UFS to ZFS, is OK,
if you copy a file from ZFS to UFS, that will be failed.
2. use tar cp command:
# tar cp ./d.tar ./d
PS. the same problem as case 1, while you extract the file between 2 different filesystem.
3. copy acl from another file with getfacl/setfacl command on UFS:
# getfacl ./a.txt |  setfacl -f - ./b.txt
PS.
You can use above command on UFS, not on ZFS.
4. copy file with zfs send/recv command:
# zfs snapshot poolname/fssource@sname

# zfs send -R poolname/fssource@sname | zfs recv -dF poolname/fstarget

Wish this helps.

regards,
Stanley Huang