[Pkg-libvirt-commits] [libguestfs] 62/146: resize: fix 'No space left on device' problem when copying to an extended partition (RHBZ#1169015)

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 17:00:33 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit 290cc3f3f7cd2280b00470fe461fbcd3da40ce35
Author: Hu Tao <hutao at cn.fujitsu.com>
Date:   Mon Dec 8 11:20:54 2014 +0800

    resize: fix 'No space left on device' problem when copying to an extended partition (RHBZ#1169015)
    
    Because of the size of an extended partition reported by Linux is always 1024
    bytes, so it will always fail to copy to an extended partition.
    
    This patch fixes this problem by copying to the offset of an extended
    partition in the destination disk.
    
    Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
    (cherry picked from commit 9d6f0b6a86d68438b27a3d783677c63f39ec6627)
---
 resize/resize.ml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/resize/resize.ml b/resize/resize.ml
index f54b11f..5c0640a 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -1138,9 +1138,15 @@ read the man page virt-resize(1).
             * source = "/dev/sda2", because the device name only covers
             * the first 1K of the partition.  Instead, copy the
             * source bytes from the parent disk (/dev/sda).
+            *
+            * You can't write directly to the extended partition,
+            * because the size of it reported by Linux is always 1024
+            * bytes. Instead, write to the offset of the extended
+            * partition in the destination disk (/dev/sdb).
             *)
            let srcoffset = p.p_part.G.part_start in
-           g#copy_device_to_device ~srcoffset ~size:copysize "/dev/sda" target
+           let destoffset = p.p_target_start *^ 512L in
+           g#copy_device_to_device ~srcoffset ~destoffset ~size:copysize "/dev/sda" "/dev/sdb"
         )
       | OpIgnore | OpDelete -> ()
   in

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list