I found on faq/clonezilla theis steps: can the followings steps be scripted, maybe with options -o0 and o1?
2. Login in as root in the target machine, use fdisk to create the partitions you want. Remember every partition size should be larger than that in the image file.
3. Now use dcs -> clonezilla-start -> clonezilla-restore-disk in server, remember to choose option -k (Do NOT create partition in target harddisk in client), and option -r (Resize the partition when restoration finishes).
Thanks in advance?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, i understand why didn't receive any answer, i've found the solution,
to restore an image from smaller disk to larger one you have to use -k1 -r options, this didn't worked for me because i had a problem on image and see an error when ntfsresize try to re-size the disk the error was: "cannot mount the images because the journal is unclean" or something like that with an ntfs images from windows.
Finally i had to re-image the disk and know clonezilla do the rest, i can now restore 40G into a 160G or 240G.
Salento.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've been researching this for hours now but cannot quite understand what the problem is with the image in the first place?
Everytime we try to use the -k1, -r options to resize any Windows Image it simply doesn't work.
If somebody could be so kind as to quickly detail what might be the problem with the image in the first place that is stopping the resize process from working, it really would be very much appreciated.
Many Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to do this also, I just posted a new topic about it. Any luck since then? I know this a year old or so, but I have searched the net with only some great ideas but no tried and true way of success yet.
Best,
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello everyone. This is my first post on this forum so forgive me if I violate any type of rule. I work for a company with 1200+ users and we use clonezilla to image our laptops/desktops (both windows 7 and windows xp). We routinely restore to larger drives than what was used when an image was first created. This may have already been suggested but all we is to make sure the -jl option is NOT enabled when restoring. This option does this: Write MBR (512MB) again after image is restored . We then DO enable the -kl option. This options does this: Create partion table proportionally .
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm now restoring a VM about 8 GB in total to a 160 GB physical machine. It works really nicely, except the sizes of the partitions need to be tweaked slightly. I tried overwriting the sda-pt.sf file in the /partimage directory but I got an error message:
Partition cannot be outside of disk.
I was careful about overwriting sda-part.sf with values that make sense are within the disk size. I'm assuming this is because I'm imaging over an old disk that was only 8 GB.
What I would *really* like to do is modify the ocs-resize-part script in the drbl server's /opt/drbl/sbin/ directory to give a predetermined size to each partition..so I tried doing that in the cases method and I added some nested if statements to match the condition of /dev/sda1 =true then resize to 1 GB, /dev/sda2 =true then resize to 2 GB etc etc.
Funny thing is, when I run Clonezilla, its almost as if the commands never execute that way. I rechecked my syntax, but is there any idea why the resize won't execute??
Is it the options I'm choosing/not choosing in expert mode? I've tried -r but possibly need to choose "Do Not Create Partition Table"?
Mike.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"is modify the ocs-resize-part script in the drbl server's /opt/drbl/sbin/ " -> Please post the file you have modified. It's easier for us to check.
Thanks.
Steven.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the reply. After a few posts and some though I realized that I do need to resize the partitions first on the target machine, so I headed over to the /opt/drbl/samples directory and grabbed the:
create-2P-pt-fs
and took a look. I have read that four primary partitions (boot, swap, root, and home) are required to have a running environment for what I intend to do, which is just run software. So I started to experiment with adding more partitions to the script to be created but I am getting an error that I will post shortly. Here are the edits I did in two scripts, everything in green was added to make it easier on the eye:
Green Text: added to script by me
Resizing the Partitions
Line 40 of /samples/create-2P-pt-sf customizations
swap="$(echo "scale=0; $swap_size * $cylinders / $hd_size" | bc -l)"
root="$(echo "scale=0; $cylinders - (5*$swap)" | bc -l)"
home="$(echo "scale=0; $cylinders - $root" | bc -l)"
cat <<-EOF > $PT_TMP
0,$root,L,*
,,S
EOF
Resizing the File Systems
Note: I am using ext 4 on all of my partitions except swap of course (boot, root, home)
Line 95 - ocs-resize-part script in drbl/sbin customizations:
case "$part_fs" in
reiserfs)
if ! which resize_reiserfs &> /dev/null; then
echo "Unable to find program resize_reiserfs! Skip this partition ${partition}"
exit 1
fi
&& resize_reiserfs_opt="-f"
echo "resize_reiserfs $resize_reiserfs_opt ${partition}"
resize_reiserfs $resize_reiserfs_opt ${partition}
;;
vfat|fat16|fat32)
if ! which parted &> /dev/null; then
echo "Unable to find program parted! Skip this partition ${partition}"
exit 1
fi
&& parted_resize_opt="-s"
# resize MINOR START END
echo "parted $parted_resize_opt $target_hd resize $DEST_PART $part_start $part_end"
parted $parted_resize_opt $target_hd resize $DEST_PART $part_start $part_end
;;
ext2|ext3|ext4)
if ! which e2fsck &> /dev/null || ! which resize2fs &> /dev/null ; then
echo "Unable to find program e2fsck! Skip this partition ${partition}"
exit 1
fi
&& resize2fs_opt="-f"
if ; then
echo "e2fsck -f -y ${partition}; resize2fs $resize2fs_opt ${partition} 1G"
e2fsck -f -y ${partition}
resize2fs $resize2fs_opt ${partition} 1G
else
(
2012-08-08 13:30:43 PDT
Hi Salento, I am trying to do this also, I just posted a new topic about it. Any luck since then? I know this a year old or so, but I have searched the net with only some great ideas but no tried and true way of success yet. Best, à)
Hi all,
maybe is to late…
I worked with clonezilla/drbl during 1 year since then no more experiences (i really appreciate working with this great product)
my problem was to clone a disk from an image of 40GB to a bigger one ( 80, 160 gb), the error message was "cannot mount the images because the journal is unclean" during clone part process,
i had a physical disk with the master image backup and i connected the disk on a pc to check what was wrong with image and at the first boot windows started a check disk ( that was -> the journal is unclean) after i copied/created again a new image with drbl/clonezilla and everything worked fine again, of course you have to manage to create a small master image for ex. a disk 40 gb this to be able to image disks bigger then the image master. hope this help.
best regards.
Salento
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying the same procedure as Salento explains. I have an image of a VM a disk with 30GB and only one 30GB partition and I'm trying to restore it in larger disks. I'm using the options mentioned (-r and -k1) but despite the restoration be done successfully the 30GB partition is never extended to the end of the disc and I have to extend it manually. The resizing occurs without errors but the device size is displayed in partclone 30GB and not the size of the disk of the computer. I think a mistake was occurring at the time of recording the MBR more specifically in defining the disk size (proportionally with the option-k1) but I'm not sure. Could anyone help me?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So if you are sure the partition size is larger than the file system size, you can run something like:
/usr/sbin/ocs-resize-part /dev/sdg1
(replace /dev/sdg1 with your partition name)
on Clonezilla live 2.1.0-26.
Please show us the output on the screen.
Steven.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
My question is:
Is there a way to automatically restore and resize a small disk image to a large one and fit the entire target disk space?
I can do that with ghost but ( no license) it was the raison why a installed a clonezilla-drbl server.
Thanks in advance.
Salento.
i used -k1 option but don't works
Hi,
I found on faq/clonezilla theis steps: can the followings steps be scripted, maybe with options -o0 and o1?
2. Login in as root in the target machine, use fdisk to create the partitions you want. Remember every partition size should be larger than that in the image file.
3. Now use dcs -> clonezilla-start -> clonezilla-restore-disk in server, remember to choose option -k (Do NOT create partition in target harddisk in client), and option -r (Resize the partition when restoration finishes).
Thanks in advance?
OK, i understand why didn't receive any answer, i've found the solution,
to restore an image from smaller disk to larger one you have to use -k1 -r options, this didn't worked for me because i had a problem on image and see an error when ntfsresize try to re-size the disk the error was: "cannot mount the images because the journal is unclean" or something like that with an ntfs images from windows.
Finally i had to re-image the disk and know clonezilla do the rest, i can now restore 40G into a 160G or 240G.
Salento.
Nice. You have found the solution there.
Thanks for sharing that.
Steven.
Sorry to drag this up again.
I've been researching this for hours now but cannot quite understand what the problem is with the image in the first place?
Everytime we try to use the -k1, -r options to resize any Windows Image it simply doesn't work.
If somebody could be so kind as to quickly detail what might be the problem with the image in the first place that is stopping the resize process from working, it really would be very much appreciated.
Many Thanks
" resize any Windows Image it simply doesn't work." -> What the error messages?
More description?
Steven.
Hi Salento,
I am trying to do this also, I just posted a new topic about it. Any luck since then? I know this a year old or so, but I have searched the net with only some great ideas but no tried and true way of success yet.
Best,
Mike
Hello everyone. This is my first post on this forum so forgive me if I violate any type of rule. I work for a company with 1200+ users and we use clonezilla to image our laptops/desktops (both windows 7 and windows xp). We routinely restore to larger drives than what was used when an image was first created. This may have already been suggested but all we is to make sure the -jl option is NOT enabled when restoring. This option does this: Write MBR (512MB) again after image is restored . We then DO enable the -kl option. This options does this: Create partion table proportionally .
Hi everyone,
I'm now restoring a VM about 8 GB in total to a 160 GB physical machine. It works really nicely, except the sizes of the partitions need to be tweaked slightly. I tried overwriting the sda-pt.sf file in the /partimage directory but I got an error message:
Partition cannot be outside of disk.
I was careful about overwriting sda-part.sf with values that make sense are within the disk size. I'm assuming this is because I'm imaging over an old disk that was only 8 GB.
What I would *really* like to do is modify the ocs-resize-part script in the drbl server's /opt/drbl/sbin/ directory to give a predetermined size to each partition..so I tried doing that in the cases method and I added some nested if statements to match the condition of /dev/sda1 =true then resize to 1 GB, /dev/sda2 =true then resize to 2 GB etc etc.
Funny thing is, when I run Clonezilla, its almost as if the commands never execute that way. I rechecked my syntax, but is there any idea why the resize won't execute??
Is it the options I'm choosing/not choosing in expert mode? I've tried -r but possibly need to choose "Do Not Create Partition Table"?
Mike.
"is modify the ocs-resize-part script in the drbl server's /opt/drbl/sbin/ " -> Please post the file you have modified. It's easier for us to check.
Thanks.
Steven.
Hi Steven,
Thanks for the reply. After a few posts and some though I realized that I do need to resize the partitions first on the target machine, so I headed over to the /opt/drbl/samples directory and grabbed the:
create-2P-pt-fs
and took a look. I have read that four primary partitions (boot, swap, root, and home) are required to have a running environment for what I intend to do, which is just run software. So I started to experiment with adding more partitions to the script to be created but I am getting an error that I will post shortly. Here are the edits I did in two scripts, everything in green was added to make it easier on the eye:
Green Text: added to script by me
Resizing the Partitions
Line 40 of /samples/create-2P-pt-sf customizations
# partition
hd_size="$(sfdisk -s /dev/$chosen_hd)"
cylinders="$(sfdisk -g /dev/$chosen_hd | awk '{ print $2; }')"
swap="$(echo "scale=0; $swap_size * $cylinders / $hd_size" | bc -l)"
root="$(echo "scale=0; $cylinders - (5*$swap)" | bc -l)"
home="$(echo "scale=0; $cylinders - $root" | bc -l)"
cat <<-EOF > $PT_TMP
0,$root,L,*
,,S
EOF
Resizing the File Systems
Note: I am using ext 4 on all of my partitions except swap of course (boot, root, home)
Line 95 - ocs-resize-part script in drbl/sbin customizations:
case "$part_fs" in
reiserfs)
if ! which resize_reiserfs &> /dev/null; then
echo "Unable to find program resize_reiserfs! Skip this partition ${partition}"
exit 1
fi
&& resize_reiserfs_opt="-f"
echo "resize_reiserfs $resize_reiserfs_opt ${partition}"
resize_reiserfs $resize_reiserfs_opt ${partition}
;;
vfat|fat16|fat32)
if ! which parted &> /dev/null; then
echo "Unable to find program parted! Skip this partition ${partition}"
exit 1
fi
&& parted_resize_opt="-s"
# resize MINOR START END
echo "parted $parted_resize_opt $target_hd resize $DEST_PART $part_start $part_end"
parted $parted_resize_opt $target_hd resize $DEST_PART $part_start $part_end
;;
ext2|ext3|ext4)
if ! which e2fsck &> /dev/null || ! which resize2fs &> /dev/null ; then
echo "Unable to find program e2fsck! Skip this partition ${partition}"
exit 1
fi
&& resize2fs_opt="-f"
if ; then
echo "e2fsck -f -y ${partition}; resize2fs $resize2fs_opt ${partition} 1G"
e2fsck -f -y ${partition}
resize2fs $resize2fs_opt ${partition} 1G
else
if ; then
echo "e2fsck -f -y ${partition}; resize2fs $resize2fs_opt ${partition} 2G"
e2fsck -f -y ${partition}
resize2fs $resize2fs_opt ${partition} 2G
else
if ; then
echo "e2fsck -f -y ${partition}; resize2fs $resize2fs_opt ${partition} 147G"
e2fsck -f -y ${partition}
resize2fs $resize2fs_opt ${partition} 147G
else
if ; then
echo "e2fsck -f -y ${partition}; resize2fs $resize2fs_opt ${partition} 10G"
e2fsck -f -y ${partition}
resize2fs $resize2fs_opt ${partition} 10G
fi
Any updates?
Steven.
(
2012-08-08 13:30:43 PDT
Hi Salento, I am trying to do this also, I just posted a new topic about it. Any luck since then? I know this a year old or so, but I have searched the net with only some great ideas but no tried and true way of success yet. Best, à)
Hi all,
maybe is to late…
I worked with clonezilla/drbl during 1 year since then no more experiences (i really appreciate working with this great product)
my problem was to clone a disk from an image of 40GB to a bigger one ( 80, 160 gb), the error message was "cannot mount the images because the journal is unclean" during clone part process,
i had a physical disk with the master image backup and i connected the disk on a pc to check what was wrong with image and at the first boot windows started a check disk ( that was -> the journal is unclean) after i copied/created again a new image with drbl/clonezilla and everything worked fine again, of course you have to manage to create a small master image for ex. a disk 40 gb this to be able to image disks bigger then the image master. hope this help.
best regards.
Salento
Hi all!
I'm trying the same procedure as Salento explains. I have an image of a VM a disk with 30GB and only one 30GB partition and I'm trying to restore it in larger disks. I'm using the options mentioned (-r and -k1) but despite the restoration be done successfully the 30GB partition is never extended to the end of the disc and I have to extend it manually. The resizing occurs without errors but the device size is displayed in partclone 30GB and not the size of the disk of the computer. I think a mistake was occurring at the time of recording the MBR more specifically in defining the disk size (proportionally with the option-k1) but I'm not sure. Could anyone help me?
So if you are sure the partition size is larger than the file system size, you can run something like:
/usr/sbin/ocs-resize-part /dev/sdg1
(replace /dev/sdg1 with your partition name)
on Clonezilla live 2.1.0-26.
Please show us the output on the screen.
Steven.