|
|
ffd6ed |
From 67cdc9c732090a47f7f0345d43614c8b4a527f53 Mon Sep 17 00:00:00 2001
|
|
|
ffd6ed |
From: Hu Tao <hutao@cn.fujitsu.com>
|
|
|
ffd6ed |
Date: Mon, 8 Dec 2014 11:20:54 +0800
|
|
|
ffd6ed |
Subject: [PATCH] resize: fix 'No space left on device' problem when copying to
|
|
|
ffd6ed |
an extended partition (RHBZ#1169015)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
Because of the size of an extended partition reported by Linux is always 1024
|
|
|
ffd6ed |
bytes, so it will always fail to copy to an extended partition.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
This patch fixes this problem by copying to the offset of an extended
|
|
|
ffd6ed |
partition in the destination disk.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
|
|
|
ffd6ed |
(cherry picked from commit 9d6f0b6a86d68438b27a3d783677c63f39ec6627)
|
|
|
ffd6ed |
---
|
|
|
ffd6ed |
resize/resize.ml | 8 +++++++-
|
|
|
ffd6ed |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
diff --git a/resize/resize.ml b/resize/resize.ml
|
|
|
ffd6ed |
index b581b39..b4e8990 100644
|
|
|
ffd6ed |
--- a/resize/resize.ml
|
|
|
ffd6ed |
+++ b/resize/resize.ml
|
|
|
ffd6ed |
@@ -1152,9 +1152,15 @@ read the man page virt-resize(1).
|
|
|
ffd6ed |
* source = "/dev/sda2", because the device name only covers
|
|
|
ffd6ed |
* the first 1K of the partition. Instead, copy the
|
|
|
ffd6ed |
* source bytes from the parent disk (/dev/sda).
|
|
|
ffd6ed |
+ *
|
|
|
ffd6ed |
+ * You can't write directly to the extended partition,
|
|
|
ffd6ed |
+ * because the size of it reported by Linux is always 1024
|
|
|
ffd6ed |
+ * bytes. Instead, write to the offset of the extended
|
|
|
ffd6ed |
+ * partition in the destination disk (/dev/sdb).
|
|
|
ffd6ed |
*)
|
|
|
ffd6ed |
let srcoffset = p.p_part.G.part_start in
|
|
|
ffd6ed |
- g#copy_device_to_device ~srcoffset ~size:copysize "/dev/sda" target
|
|
|
ffd6ed |
+ let destoffset = p.p_target_start *^ 512L in
|
|
|
ffd6ed |
+ g#copy_device_to_device ~srcoffset ~destoffset ~size:copysize "/dev/sda" "/dev/sdb"
|
|
|
ffd6ed |
)
|
|
|
ffd6ed |
| OpIgnore | OpDelete -> ()
|
|
|
ffd6ed |
in
|
|
|
ffd6ed |
--
|
|
|
ffd6ed |
1.8.3.1
|
|
|
ffd6ed |
|