[Please follow up on libguestfs(a)redhat.com, there is no need to subscribe]
On Mon, Jun 13, 2016 at 04:03:20PM +0200, Vlastimil Burián wrote:
Hello Richard,
I need a little help with libguestfs-tools
I used it as follows:
|sudo guestmount -a thevirtualdisk.vhdx -i /mnt/anydirectory |
But so far I have no clue as to if it is possible and if yes, then how
to clear the NTFS compression attribute(?) supposing I have mounted a
virt. disk NTFS compressed.
https://serverfault.com/questions/783548/hyper-v-how-to-connect-compresse...
If you just want to do it with libguestfs and don't need to automate
the process (ie. you're only doing it one-off for a few disks), then
it's better to use virt-rescue. Something like this:
$ virt-rescue -a thedisk
<rescue> mount /dev/sda2 /sysroot
<rescue> cd /sysroot
<rescue> setfattr -h -v 0x00000000 -n system.ntfs_attrib directory-name
(See also:
http://www.tuxera.com/community/ntfs-3g-advanced/data-compression/)
You can also use the regular getfattr command to list the attribute,
although the format seems to need a bit of decoding:
<rescue> mkdir compressed
<rescue> setfattr -h -v 0x00080000 -n system.ntfs_attrib compressed
<rescue> mkdir uncompressed
<rescue> setfattr -h -v 0x00000000 -n system.ntfs_attrib uncompressed
<rescue> getfattr -n system.ntfs_attrib compressed
# file: compressed
system.ntfs_attrib=0sEAgAAA==
<rescue> getfattr -n system.ntfs_attrib uncompressed/
#
file: uncompressed/
system.ntfs_attrib=0sEAAAAA==
Unfortunately these attributes are not passed through FUSE. I suspect
that is because they are in the system.* namespace which the kernel
handles specially, but there are also a bunch of bugs associated with
extended attributes & guestmount and maybe this is one of them.
It should be possible to read and set the attributes through the API
(eg. using guestfish). See the APIs guestfs_lsetxattr and
guestfs_lgetxattr and related.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages.
http://libguestfs.org