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

Re: [Libguestfs] Does anybody know how to use the getxattr/setxattr commmands in guestfish?



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


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