First of all I would like to thank everybody for creating such a great piece of software.
For the first time i have stumbled upon a problem for which I need some help/guidance.
I create our images on a server in Hyper-VM's which with a disk based on 512 logical sectors on 4096 physical sectors, which works perfectly on our laptops. To give a idea, we currently maintain 90 images
for around 300.000 educational laptops.
But now, for the first time, we have a test laptop with UFS storage device which has a 4096 logical and 4096 physical sector size.
When i restore our 52GB (512/4096 sector sizes) based image to the UFS storage , it says the disk is to small. It is being restored to a to a 128GB UFS (4096/4096).
For testing purposes I have created a 52GB 4096/4096 image which restores without a problem. It also restores and resizes to available disk space also works as usual.
But I can't restore the 4096/4096 image to a 512/4096 disk.
And when I try to restore the 512/4096 image to the 4096/4096 disk the system can't create the 3rd partition which is the largest containing windows.
the source disk is build on sd(a) which is restored to the target disk is on a nvme(n0). Which normally
goes perfect due to the automatic tempory creation/conversion of the image files.
I am using the following command to restore the image:
ocs-sr -b -g auto -e1 auto -e2 -k1 -r -j2 -scr -p true restoredisk images/"$imagename" $target
So my main question/problem is: (how) can I use one image on a 512/4096 and on 4096/4096 storage device ?
Our nightmare scenario is that we will have to maintain 180 instead of 90 images.
Thanks for reading my problem and hope to hear from you,
Any advice woudl be appreciated.
Hope to hear
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"And when I try to restore the 512/4096 image to the 4096/4096 disk the system can't create the 3rd partition which is the largest containing windows. " -> What the error messages on the screen?
You can also share the file /var/log/cloezilla.log
Thanks.
Steven
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have added two Clonezilla log files, one with the resize parameter and one without the resize parameter. I also added a two zip files with information about the image.
Without the resize i see the error :
/dev/sda3: Can't recalculate partition size to the device sectors line 10: unsupported command
I hope you have an idea which line 10 :)
With the resize command, i see the following:
Size of original disk: 109051904 sectors.
Size of target disk : 31246336 sectors.
The ratio for target disk size to original disk size is .2865271935.
The target disk (size= 31246336 sectors) is smaller than the source disk (size= 109051904 sectors)!
Clonezilla won't be able to restore a partition image to smaller partition!
If you are sure, use the option "-icds" in Clonezilla or ocs-expand-gpt-pt to force to write the partition table.
Program terminated!
There are less sectors available, but the sector size is larger. So Expansion should be possible. This is by-the-way the second problem. It would be great to be able to resize
our 52GB image to 128, 256 or 512 GB storage devices.
I whish you a good bug hunting and if you need any more information please let me know.
maybe I got you a little side-tracked by my comment on the resize.
But even without the resize, restore doesn't work and is this error reported:
"/dev/sda3: Can't recalculate partition size to the device sectors
line 10: unsupported command"
To explain the problem a little more in detail:
The source disk is 52GB (512/4096), the smallest disk size that windows accepts installing to.
When restoring to a 128GB (512/4096) it works OK. But in this case the target disk is 128GB (4096/4096).
The source disk is smaller in storage capacity than the target disk.
The source disk has more sectors than the target disk.
The source disk has 109.051.904 sectors * 512 bytes = 55.834.574.848 bytes (52 GB).
The target disk has 31.246.336 sector * 4096 bytes = 127.984.992.256 bytes (119,19GB).
If i do a calculation in reverse, to make the number of sectors fit I would need to shrink my source disk to 31.246.338 * 512 = 15.998.124.032(14,9GB), which I can't.
Or the other way around 109.051.904 * 4096 bytes = 446.676.598.784 bytes (416GB)
I need a 416GB disk to do the restore.
I did create a VM disk of 425GB and tried the restore, but I still got the error :
"/dev/sda3: Can't recalculate partition size to the device sectors
line 10: unsupported command"
If you would, you can recreate the problem by using Hyper-V machines and create the harddisk manually using:
After install windows 10/11 on the source disks, save the disks to an image.
I did some more testing during the creation of this reply and made a overview table
to give an insight of which restores work and which don't work.
Source | Target | Target | Error
| 512-512| 4K-4K |
--------------------- | ---------- | ----------- | -------------------------------------------------------------------
4k-4k | OK | OK |
--------------------- | ---------- | ----------- | -------------------------------------------------------------------
4k-4k+resize | Failed | OK | "/dev/sda3: Can't recalculate partition size to the
| | | device sectors" "line 10: unsupported command"
--------------------- | ---------- | ----------- | -------------------------------------------------------------------
512-4k | OK | Failed | Failed to create a partition table, is this disk to small?"
--------------------- | ---------- | ----------- | -------------------------------------------------------------------
512-4k+resize | OK | Failed | Target disk is smaller than source disk"
--------------------- | ---------- | --------- - | --------------------------------------------------------------------
512-512 | OK | Failed | Failed to create a partition table, is this disk to small?"
--------------------- | ---------- | ----------- | -------------------------------------------------------------------
512-512+resize | OK | Failed | Target disk is smaller than source disk"
-------------------- - | ---------- | ----------- | ------------------------------------------------------------------
If it would be possible to make the 4k-4k resize restore work on a 512/512 disk, than I have a working solution.
I need to create an automated solution because in the summer vacation we produce around 100.000 laptops in less than 6 weeks for the new students who start after the summer.
I hope to hear from you,
in any case thanks for your time.
Last edit: Francois 2023-11-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Francois,
I was wrong, your case is GPT, not MBR partition table.
You meant you will have 100.000 laptops? 100k? or 100 machines... :D
OK, so which version of Clonezilla live did you use? I'd like to try to reproduce this issue here.
BTW, could you please also share the file "/home/partimag/images/test_w10_4k-512_nl/sda-pt.sf"?
Thanks.
Steven
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for my very very delayed response. I feel guilty for leaving you hanging here.
We have eliminated the problem by demanding that our supplier delivers the systems with an 512 bytes orientated storage device.
For your information, we do produce each year around 100.000 machines. Our base is around 350.000 machines which we maintain and repair for schools in the Netherlands, Belgium and England.
Currently I have another problem, for that i will open another discussion thread.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"For your information, we do produce each year around 100.000 machines. Our base is around 350.000 machines which we maintain and repair for schools in the Netherlands, Belgium and England." -> Wow, that's terrific.
Thanks for sharing that.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi there,
First of all I would like to thank everybody for creating such a great piece of software.
For the first time i have stumbled upon a problem for which I need some help/guidance.
I create our images on a server in Hyper-VM's which with a disk based on 512 logical sectors on 4096 physical sectors, which works perfectly on our laptops. To give a idea, we currently maintain 90 images
for around 300.000 educational laptops.
But now, for the first time, we have a test laptop with UFS storage device which has a 4096 logical and 4096 physical sector size.
When i restore our 52GB (512/4096 sector sizes) based image to the UFS storage , it says the disk is to small. It is being restored to a to a 128GB UFS (4096/4096).
For testing purposes I have created a 52GB 4096/4096 image which restores without a problem. It also restores and resizes to available disk space also works as usual.
But I can't restore the 4096/4096 image to a 512/4096 disk.
And when I try to restore the 512/4096 image to the 4096/4096 disk the system can't create the 3rd partition which is the largest containing windows.
the source disk is build on sd(a) which is restored to the target disk is on a nvme(n0). Which normally
goes perfect due to the automatic tempory creation/conversion of the image files.
I am using the following command to restore the image:
ocs-sr -b -g auto -e1 auto -e2 -k1 -r -j2 -scr -p true restoredisk images/"$imagename" $target
So my main question/problem is:
(how) can I use one image on a 512/4096 and on 4096/4096 storage device ?
Our nightmare scenario is that we will have to maintain 180 instead of 90 images.
Thanks for reading my problem and hope to hear from you,
Any advice woudl be appreciated.
Hope to hear
"And when I try to restore the 512/4096 image to the 4096/4096 disk the system can't create the 3rd partition which is the largest containing windows. " -> What the error messages on the screen?
You can also share the file /var/log/cloezilla.log
Thanks.
Steven
Hi Steven,
thanks for your reply.
I have added two Clonezilla log files, one with the resize parameter and one without the resize parameter. I also added a two zip files with information about the image.
Without the resize i see the error :
/dev/sda3: Can't recalculate partition size to the device sectors
line 10: unsupported command
I hope you have an idea which line 10 :)
With the resize command, i see the following:
Size of original disk: 109051904 sectors.
Size of target disk : 31246336 sectors.
The ratio for target disk size to original disk size is .2865271935.
The target disk (size= 31246336 sectors) is smaller than the source disk (size= 109051904 sectors)!
Clonezilla won't be able to restore a partition image to smaller partition!
If you are sure, use the option "-icds" in Clonezilla or ocs-expand-gpt-pt to force to write the partition table.
Program terminated!
There are less sectors available, but the sector size is larger. So Expansion should be possible. This is by-the-way the second problem. It would be great to be able to resize
our 52GB image to 128, 256 or 512 GB storage devices.
I whish you a good bug hunting and if you need any more information please let me know.
Best regards,
Francois
As I have mentioned, the mechanism for resizing a disk, especially restoring an image saved from larger disk to a smaller one does not always work in Clonezilla.
Your case is MBR partition table, and it has more limitations.
I believe it' s nothing to do with 4k/512.
I suggest you follow this to give it a try:
https://drbl.org/fine-print.php?path=./faq/2_System/119_larger_to_smaller_disk_restore_clone.faq#119_larger_to_smaller_disk_restore_clone.faq
Especially the method 2.
Steven
Hi Steven,
maybe I got you a little side-tracked by my comment on the resize.
But even without the resize, restore doesn't work and is this error reported:
"/dev/sda3: Can't recalculate partition size to the device sectors
line 10: unsupported command"
To explain the problem a little more in detail:
The source disk is 52GB (512/4096), the smallest disk size that windows accepts installing to.
When restoring to a 128GB (512/4096) it works OK. But in this case the target disk is 128GB (4096/4096).
The source disk is smaller in storage capacity than the target disk.
The source disk has more sectors than the target disk.
The source disk has 109.051.904 sectors * 512 bytes = 55.834.574.848 bytes (52 GB).
The target disk has 31.246.336 sector * 4096 bytes = 127.984.992.256 bytes (119,19GB).
If i do a calculation in reverse, to make the number of sectors fit I would need to shrink my source disk to 31.246.338 * 512 = 15.998.124.032(14,9GB), which I can't.
Or the other way around 109.051.904 * 4096 bytes = 446.676.598.784 bytes (416GB)
I need a 416GB disk to do the restore.
I did create a VM disk of 425GB and tried the restore, but I still got the error :
"/dev/sda3: Can't recalculate partition size to the device sectors
line 10: unsupported command"
If you would, you can recreate the problem by using Hyper-V machines and create the harddisk manually using:
target disk 4096:
New-VHD -path .\targetdisk4096.vhdx -SizeBytes 128GB -LogicalSectorSizeBytes 4096 -PhysicalSectorSizeBytes 4096
target disk 512:
New-VHD -path .\targetdisk512.vhdx -SizeBytes 128GB -LogicalSectorSizeBytes 512 -PhysicalSectorSizeBytes 512
Source disk 4096:
New-VHD -path .\sourcedisk4096.vhdx -SizeBytes 52GB -LogicalSectorSizeBytes 4096 -PhysicalSectorSizeBytes 4096
Source disk 512:
New-VHD -path .\sourcedisk512.vhdx -SizeBytes 52GB -LogicalSectorSizeBytes 512 -PhysicalSectorSizeBytes 4096
After install windows 10/11 on the source disks, save the disks to an image.
I did some more testing during the creation of this reply and made a overview table
to give an insight of which restores work and which don't work.
Source | Target | Target | Error
| 512-512| 4K-4K |
--------------------- | ---------- | ----------- | -------------------------------------------------------------------
4k-4k | OK | OK |
--------------------- | ---------- | ----------- | -------------------------------------------------------------------
4k-4k+resize | Failed | OK | "/dev/sda3: Can't recalculate partition size to the
| | | device sectors" "line 10: unsupported command"
--------------------- | ---------- | ----------- | -------------------------------------------------------------------
512-4k | OK | Failed | Failed to create a partition table, is this disk to small?"
--------------------- | ---------- | ----------- | -------------------------------------------------------------------
512-4k+resize | OK | Failed | Target disk is smaller than source disk"
--------------------- | ---------- | --------- - | --------------------------------------------------------------------
512-512 | OK | Failed | Failed to create a partition table, is this disk to small?"
--------------------- | ---------- | ----------- | -------------------------------------------------------------------
512-512+resize | OK | Failed | Target disk is smaller than source disk"
-------------------- - | ---------- | ----------- | ------------------------------------------------------------------
If it would be possible to make the 4k-4k resize restore work on a 512/512 disk, than I have a working solution.
I need to create an automated solution because in the summer vacation we produce around 100.000 laptops in less than 6 weeks for the new students who start after the summer.
I hope to hear from you,
in any case thanks for your time.
Last edit: Francois 2023-11-22
Hi Francois,
I was wrong, your case is GPT, not MBR partition table.
You meant you will have 100.000 laptops? 100k? or 100 machines... :D
OK, so which version of Clonezilla live did you use? I'd like to try to reproduce this issue here.
BTW, could you please also share the file "/home/partimag/images/test_w10_4k-512_nl/sda-pt.sf"?
Thanks.
Steven
Hi Steven,
Sorry for my very very delayed response. I feel guilty for leaving you hanging here.
We have eliminated the problem by demanding that our supplier delivers the systems with an 512 bytes orientated storage device.
For your information, we do produce each year around 100.000 machines. Our base is around 350.000 machines which we maintain and repair for schools in the Netherlands, Belgium and England.
Currently I have another problem, for that i will open another discussion thread.
"For your information, we do produce each year around 100.000 machines. Our base is around 350.000 machines which we maintain and repair for schools in the Netherlands, Belgium and England." -> Wow, that's terrific.
Thanks for sharing that.