Does anybody know how to use the getxattr/setxattr commmands in guestfish?
Hi All, Does anybody know how to use the getxattr/setxattr commands in guestfish? It seems not working for ext2/3 filesystem. I did not find the corresponding commands in bash either. So is it for xfs only? Regards, Pengzhen Cao
On Thu, Apr 08, 2010 at 09:49:26AM +0800, Pengzhen Cao wrote:
Hi All,
Does anybody know how to use the getxattr/setxattr commands in guestfish? It seems not working for ext2/3 filesystem. I did not find the corresponding commands in bash either. So is it for xfs only?
Not just for xfs, this should work for ext2/3 as well. The problem is you cannot just create any xattr. The kernel will only recognize certain xattrs on files, so it's probably best to read the attr(5) manual page first. Can you post some examples of commands you are trying to use? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
On Thu, Apr 08, 2010 at 09:01:31AM +0100, Richard W.M. Jones wrote:
On Thu, Apr 08, 2010 at 09:49:26AM +0800, Pengzhen Cao wrote:
Hi All,
Does anybody know how to use the getxattr/setxattr commands in guestfish? It seems not working for ext2/3 filesystem. I did not find the corresponding commands in bash either. So is it for xfs only?
Not just for xfs, this should work for ext2/3 as well.
The problem is you cannot just create any xattr. The kernel will only recognize certain xattrs on files, so it's probably best to read the attr(5) manual page first.
In particular in order to set user.* attributes, you have to mount the filesystem with the user_xattr option. The example guestfish script below shows how to do it. $ /tmp/test.fish Extended attributes before setting Extended attributes after setting [0] = { attrname: user.test attrval: hello } Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
On 04/08/2010 05:07 PM, Richard W.M. Jones wrote:
On Thu, Apr 08, 2010 at 09:01:31AM +0100, Richard W.M. Jones wrote:
On Thu, Apr 08, 2010 at 09:49:26AM +0800, Pengzhen Cao wrote:
Hi All,
Does anybody know how to use the getxattr/setxattr commands in guestfish? It seems not working for ext2/3 filesystem. I did not find the corresponding commands in bash either. So is it for xfs only?
Not just for xfs, this should work for ext2/3 as well.
The problem is you cannot just create any xattr. The kernel will only recognize certain xattrs on files, so it's probably best to read the attr(5) manual page first.
In particular in order to set user.* attributes, you have to mount the filesystem with the user_xattr option. The example guestfish script below shows how to do it.
$ /tmp/test.fish Extended attributes before setting Extended attributes after setting [0] = { attrname: user.test attrval: hello }
Rich.
Thanks Richard, I forgot to use the "mount-options user_xattr /dev/xxx /" command in guestfish. It could work now. Regards, Pengzhen
participants (2)
-
Pengzhen Cao -
Richard W.M. Jones