On a windows 2003 VM, i have two LVM partitions attached I was wonder how can i use virt-ls on d: disk eg. # virt-ls -d win2003 / works fine for c: but i cant figured it out how i use this for d: -- Evaggelos Balaskas - Unix System Engineer http://gr.linkedin.com/in/evaggelosbalaskas
On Thu, Aug 02, 2012 at 02:12:38PM +0300, Evaggelos Balaskas wrote:
On a windows 2003 VM, i have two LVM partitions attached
I was wonder how can i use virt-ls on d: disk
eg.
# virt-ls -d win2003 /
works fine for c:
but i cant figured it out how i use this for d:
virt-ls doesn't support this. It ought to, because similar utilities like virt-cat do support Windows drive mappings, as does the underlying API. Unless you want to fix virt-ls sources, your best bet is probably to use the attached script. $ LIBVIRT_DEFAULT_URI=qemu:///system /tmp/listdrive.pl Win7x32TwoDisks E Program Files Program Files/Mozilla Firefox Program Files/Mozilla Firefox/plc4.dll Program Files/Mozilla Firefox/AccessibleMarshal.dll Program Files/Mozilla Firefox/application.ini Program Files/Mozilla Firefox/blocklist.xml [etc] Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
thanks for your reply and for the listdrive.pl I am guessing the same limitation apply on virt-copy-out too. -- Evaggelos Balaskas - Unix System Engineer http://gr.linkedin.com/in/evaggelosbalaskas
On Thu, Aug 02, 2012 at 02:46:25PM +0300, Evaggelos Balaskas wrote:
thanks for your reply and for the listdrive.pl
I am guessing the same limitation apply on virt-copy-out too.
virt-copy-out is just a wrapper around the guestfish copy-out command. You can use the guestfish command copy-out directly, but you have to do the drive letter mapping "by hand": guestfish --ro -d Win2003 -i <<EOF umount-all # to display drive mappings, do 'inspect-get-drive-mappings /dev/vda2' # this assumes d: is /dev/sdb1 mount-ro /dev/sdb1 / copy-out win:/foo /bar EOF There's a related RFE to have guestfish create drive mountpoints which would make this happen automagically. See the TODO file. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Thu, Aug 2, 2012 at 2:54 PM, Richard W.M. Jones <rjones@redhat.com> wrote:
but you have to do the drive letter mapping "by hand":
thats no problem at all, thanks again -- Evaggelos Balaskas - Unix System Engineer http://gr.linkedin.com/in/evaggelosbalaskas
The below set of cmds is a working test according to your help notes: mkdir -pv backup cd !$ guestfish --ro -d win2003 -i Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell Operating system: Microsoft Windows Server 2003 /dev/vda1 mounted on /
<fs> list-filesystems /dev/vda1: ntfs /dev/vdb1: ntfs <fs> umount-all <fs> mount /dev/vdb1 / <fs> glob copy-out /* .
reading guestfish manual and see some msgs like "tar: Exiting with failure status due to previous errors" i am guessing that you (we) are using tar command to copy out. the previous error is : "tar: ......... : Cannot open: File name too long" although not a big problem I've used kpartx for LVM partition, mount mapper disk and rsync files but i never had this speed. Really impressive. I 'll rsync the final output just to be sure of files. Are there any other tips ? -- Evaggelos Balaskas - Unix System Engineer http://gr.linkedin.com/in/evaggelosbalaskas
On Fri, Aug 03, 2012 at 01:38:56AM +0300, Evaggelos Balaskas wrote:
The below set of cmds is a working test according to your help notes:
mkdir -pv backup cd !$
guestfish --ro -d win2003 -i
Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems.
Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell
Operating system: Microsoft Windows Server 2003 /dev/vda1 mounted on /
<fs> list-filesystems /dev/vda1: ntfs /dev/vdb1: ntfs <fs> umount-all <fs> mount /dev/vdb1 / <fs> glob copy-out /* .
reading guestfish manual and see some msgs like
"tar: Exiting with failure status due to previous errors"
i am guessing that you (we) are using tar command to copy out.
the previous error is :
"tar: ......... : Cannot open: File name too long"
although not a big problem
It sounds like a big problem to me! Is this a standard Windows 2003 guest? Any unusual applications installed? Do you know which filename is too large? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
In our infrastructure we have some users that dont understand about the basics and are keep writing small descriptions for file names ! an example is below, the name is in Greek tar: ./Desktop/ΔΗΜΗΤΡΗΣ/ΣΥΝΤΕΛΕΣΤΕΣ ΑΠΟΣΒΕΣΗΣ Νέοι συντελεστές απόσβεσεις πάγιων περιουσιακών στοιχείων Οι συντελεστές απόσβεσης, ανώτεροι και κατώτεροι που προβλέπει το ΠΔ για κάθε είδος επιχειρηματικής δραστηριότητας.htm: Cannot open: File name too long tar: Exiting with failure status due to previous errors On Fri, Aug 3, 2012 at 10:16 AM, Richard W.M. Jones <rjones@redhat.com> wrote:
On Fri, Aug 03, 2012 at 01:38:56AM +0300, Evaggelos Balaskas wrote:
although not a big problem
It sounds like a big problem to me! Is this a standard Windows 2003 guest? Any unusual applications installed? Do you know which filename is too large?
-- Evaggelos Balaskas - Unix System Engineer http://gr.linkedin.com/in/evaggelosbalaskas
Thanks, I have filed a bug about this: https://bugzilla.redhat.com/show_bug.cgi?id=845488 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Fri, Aug 03, 2012 at 10:53:53AM +0300, Evaggelos Balaskas wrote:
In our infrastructure we have some users that dont understand about the basics and are keep writing small descriptions for file names !
an example is below, the name is in Greek
tar: ./Desktop/ΔΗΜΗΤΡΗΣ/ΣΥΝΤΕΛΕΣΤΕΣ ΑΠΟΣΒΕΣΗΣ Νέοι συντελεστές απόσβεσεις πάγιων περιουσιακών στοιχείων Οι συντελεστές απόσβεσης, ανώτεροι και κατώτεροι που προβλέπει το ΠΔ για κάθε είδος επιχειρηματικής δραστηριότητας.htm: Cannot open: File name too long
tar: Exiting with failure status due to previous errors
I looked into this more closely and it turns out that it's the tar subprocess running *on the host* which fails. The reason is clear: it's because the host filesystem (eg. ext4) doesn't support a filename of this length. ext2/3/4 supports filenames of up to 255 bytes. However because this filename contains UTF-8 chars which (in this case) are encoded as 2 bytes each, your ~200 character filename is really ~400 bytes, and that is too long. If you switched to a different host filesystem[1] then you'd be able to do this. Or keep your backup as a tarball (ie. replace 'copy-out' with 'tar-out'), since GNU tar can store unlimited length filenames. We will probably document this issue, but I don't think this is a bug in libguestfs. Rich. [1] eg: exFAT, NTFS, reiser are the only likely candidates. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
i will re-format this LVM partition to NTFS and make a new test this weekend. -- Evaggelos Balaskas - Unix System Engineer http://gr.linkedin.com/in/evaggelosbalaskas
With 175161 files - 54G of storage and an NTFS partition, i had zero errors about "Cannot open: File name too long" I run guestfish on a running (live) win2003 VM machine. although I didnt calculate time, it seemed a bit slower from before (ext4). I know that i may cross a line here, but is there any way to sync data from win2003:/dev/vdb1: ntfs to my LVM Partition through libguestfs ? or i have to do it with the traditional way (kpartx, mount map partition, rsync etc etc) -- Evaggelos Balaskas - Unix System Engineer http://gr.linkedin.com/in/evaggelosbalaskas
On Fri, Aug 03, 2012 at 04:24:36PM +0300, Evaggelos Balaskas wrote:
With 175161 files - 54G of storage and an NTFS partition, i had zero errors about "Cannot open: File name too long"
I run guestfish on a running (live) win2003 VM machine. although I didnt calculate time, it seemed a bit slower from before (ext4).
... hopefully using --ro.
I know that i may cross a line here, but is there any way to sync data from
win2003:/dev/vdb1: ntfs
to my LVM Partition through libguestfs ?
or i have to do it with the traditional way (kpartx, mount map partition, rsync etc etc)
Actually rsync is a much-requested feature for libguestfs. If you add rsync to the appliance (appliance/packagelist.in) then there's even a chance that it will work over the built-in network, although I have not actually tried it. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
well i did but it seems that i am making something wrong [ebal@mylaptop supermin.d]€ pwd -P /usr/lib/guestfs/supermin.d [ebal@mylaptop supermin.d]€ grep rsync * Binary file base.img matches hostfiles:/usr/bin/rsync hostfiles:/usr/lib/rsync hostfiles:/usr/lib/rsync/rrsync hostfiles:/usr/lib/systemd/system/rsyncd.service hostfiles:/usr/share/augeas/lenses/dist/rsyncd.aug hostfiles:/usr/share/augeas/lenses/dist/tests/test_rsyncd.aug but with guestfish
<fs> /usr/bin/rsync /boot.ini localdir/ /usr/bin/rsync: unknown command
any pointers rich ? PS: i am using archlinux ! On Fri, Aug 3, 2012 at 5:03 PM, Richard W.M. Jones <rjones@redhat.com> wrote:
Actually rsync is a much-requested feature for libguestfs. If you add rsync to the appliance (appliance/packagelist.in) then there's even a chance that it will work over the built-in network, although I have not actually tried it.
-- Evaggelos Balaskas - Unix System Engineer http://gr.linkedin.com/in/evaggelosbalaskas
On Fri, Aug 03, 2012 at 07:25:09PM +0300, Evaggelos Balaskas wrote:
but with guestfish
<fs> /usr/bin/rsync /boot.ini localdir/ /usr/bin/rsync: unknown command
You can try it in virt-rescue first, because guestfish <> virt-rescue: http://libguestfs.org/guestfs-faq.1.html#whats-the-difference-between-guestf... Assuming it works in 'virt-rescue --network', which it ought to, you can then try running it from guestfish using the debug backdoor, also described in the FAQ entry above. Something like this, not tested: guestfish <<EOF add-domain guest readonly:true set-network true run [...some mount-ro commands here...] debug sh "rsync /local server:/remote" EOF Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
On Fri, Aug 03, 2012 at 05:52:27PM +0100, Richard W.M. Jones wrote:
debug sh "rsync /local server:/remote"
debug sh isn't interactive, so the rsync command had better work without requiring any user input, like passphrases etc. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
today has being a very interesting day ! learned a ton of new things (thanks rich) and i am loving the small tips that get you from point A to point B. Yes indeed rsync exists in virt-rescue and i finally understood how debug sh works in guestfish I havent fully understand how the network-related-staff works ... but hopefully i'll get there. rsync is failing with this: "rsync: Failed to exec ssh: No such file or directory (2)" so i need to re-compile my libguestfs 1.18.5 package with openssh i am guessing this weekend (Work Forbid) i would be a step closer to success. -- Evaggelos Balaskas - Unix System Engineer http://gr.linkedin.com/in/evaggelosbalaskas
On Fri, Aug 03, 2012 at 09:54:59PM +0300, Evaggelos Balaskas wrote:
I havent fully understand how the network-related-staff works ... but hopefully i'll get there.
Enabling the network in libguestfs (before launch) adds a few flags to the qemu command line which in turn enables user networking in qemu. There are some limitations to this form of networking, mainly no incoming connections are allowed and things like 'ping' won't work: http://libguestfs.org/virt-rescue.1.html#network However as long as rsync/ssh initiates the connection from inside the appliance you'll be OK.
rsync is failing with this:
"rsync: Failed to exec ssh: No such file or directory (2)"
so i need to re-compile my libguestfs 1.18.5 package with openssh
Yup, I think so. Strange that the rsync package doesn't depend on ssh already. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
okei ... big success i would certainly need a rest and i have to put down some notes (perhaps to a blog post or a wiki page) If anybody need to do something like this, must have in mind the non "interactive" limitation. So to work with rsync, you have to setup ssh. sudo virt-rescue --network --ro -d win2003 [root@(none) /]# fdisk -l [root@(none) /]# mount /dev/vda1 /media/ [root@(none) /]# ip a [root@(none) /]# ip r [root@(none) /]# mkdir /root/.ssh/ [root@(none) /]# cd /root/.ssh/ [root@(none) /]# cat > id_dsa << EOF mpla mpla mpla EOF [root@(none) /]# chmod 0600 * [root@(none) /]# ssh -o 'StrictHostKeyChecking no' ebal@169.254.2.2 -vv ... [root@(none) /]# rsync /media/boot.ini -e 'ssh -o StrictHostKeyChecking=no' ebal@169.254.2.2:/tmp/boot.ini just amazing ! -- Evaggelos Balaskas - Unix System Engineer http://gr.linkedin.com/in/evaggelosbalaskas
On Fri, Aug 03, 2012 at 11:23:34PM +0300, Evaggelos Balaskas wrote: [...] Of course doing this in virt-rescue means you can't automate it. It should be possible to do automate all this in guestfish:
[root@(none) /]# mkdir /root/.ssh/ [root@(none) /]# cd /root/.ssh/ [root@(none) /]# cat > id_dsa << EOF mpla mpla mpla EOF
Use 'debug sh "mkdir ..."' to create the directory in the appliance, and 'debug-upload' to upload the key, and further 'debug sh' commands to set the permissions. There is no concept of current directory in libguestfs API / guestfish.
[root@(none) /]# rsync /media/boot.ini -e 'ssh -o StrictHostKeyChecking=no' ebal@169.254.2.2:/tmp/boot.ini
Then 'debug sh ...' to run this. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
participants (2)
-
Evaggelos Balaskas -
Richard W.M. Jones