I tried to use Clonezilla to copy a 4TB SSD (
/dev/sdd
), with 3 partitions, to a 2TB 3.5" SATA3 drive (/dev/sdc
). The original drive had a lot of empty space, so I had Clonezilla resize the partitions such that they fit. The e2fsprogs
package was installed.
Incidentally, I do not actually want to copy all 3 partitions, I just want a bootable system using the first 2 partitions. I thought I would copy the entire thing, then delete the third partition and resize the second. Suggestions on how to do this more efficiently would be welcome. I am not comfortable using disk destroyer (dd
).
These messages were emitted before the clone actually started:
PS. Next time you can run this command directly:
/usr/sbin/ocs-onthefly -g auto -e1 auto -e2 -r -j2 -sfsck -k1 -icds -p choose -f sdd -d sdc
This command is also saved as this file name for later use if necessary: /tmp/ocs-onthefly-2024-08-30-09-21
*****************************************************.
Press "Enter" to continue...
*****************************************************.
opt_for_ocs_sr_restore_this_run: -g auto -e1 auto -e2 -r -j2 -sfsck -k1 -icds
///WARNING/// filesystem.squashfs not found! No idea where is LIVE MEDIA!!! Assume this is running in DRBL client.
*****************************************************.
*****************************************************.
Searching for data partition(s)...
Finding all disks and partitions..
Excluding busy partition.....................
Excluding linux raid member partition.....
Unmounted partitions (including extended or swap): sdc1 sdc2
Collecting info... done!
Getting /dev/sdc1 info...
Getting /dev/sdc2 info...
WARNING!!! WARNING!!! WARNING!!!
WARNING! THE EXISTING DATA IN THIS HARDDISK/PARTITION(S) WILL BE OVERWRITTEN! ALL EXISTING DATA WILL BE LOST: sdc
*****************************************************.
Machine: VirtualBox
sdc (2000GB_Voyager_S3__pci-0000_00_0c_0-usb-0_1_1_0-scsi-0_0_0_0_ZK3085P9)
sdc1 (512M_vfat(In_Voyager_S3_)_pci-0000_00_0c_0-usb-0_1_1_0-scsi-0_0_0_0_ZK3085P9)
sdc2 (931.1G_ext4(In_Voyager_S3_)_pci-0000_00_0c_0-usb-0_1_1_0-scsi-0_0_0_0_ZK3085P9)
*****************************************************.
Are you sure you want to continue? (y/n) y
OK, let's do it!!
*****************************************************.
Let me ask you again.
WARNING!!! WARNING!!! WARNING!!!
WARNING! THE EXISTING DATA IN THIS HARDDISK/PARTITION(S) WILL BE OVERWRITTEN! ALL EXISTING DATA WILL BE LOST: sdc
*****************************************************.
Machine: VirtualBox
sdc (2000GB_Voyager_S3__pci-0000_00_0c_0-usb-0_1_1_0-scsi-0_0_0_0_ZK3085P9)
sdc1 (512M_vfat(In_Voyager_S3_)_pci-0000_00_0c_0-usb-0_1_1_0-scsi-0_0_0_0_ZK3085P9)
sdc2 (931.1G_ext4(In_Voyager_S3_)_pci-0000_00_0c_0-usb-0_1_1_0-scsi-0_0_0_0_ZK3085P9)
*****************************************************.
Are you sure you want to continue? (y/n) y
OK, let's do it!!
Saving the source device as a pseudo image. Running:
LC_ALL=C ocs-sr --ocsroot /tmp/ocs_onthefly_src.9hdcnm -luks no -sfsck -sfs -nogui -q2 --batch -j2 -scs -senc -p true savedisk d2d-pseudo sdd
Setting the TERM as linux
Starting /usr/sbin/ocs-sr at 2024-08-30 09:21:59 EDT...
Start preparing device name cache files in /tmp/ocs-cache//...
The file /proc/partitions remains the same. Skip generating disk(s) list file.
The file /proc/partitions remains the same. Skip generating partitions(s) list file.
Both /proc/partitions and blkid output do not change. Skip generating file system cache file related to the dev(s).
*****************************************************.
Clonezilla image dir: /tmp/ocs_onthefly_src.9hdcnm
*****************************************************.
The image name is: d2d-pseudo
Selected device [sdd] found!
The selected devices: sdd
*****************************************************.
Activating the partition info in /proc... done!
Selected device [sdd] found!
The selected devices: sdd
Searching for data/swap/extended partition(s)...
Finding all disks and partitions..
Excluding busy partition.....................
Excluding linux raid member partition......
Unmounted partitions (including extended or swap): sdd1 sdd2 sdd3
Collecting info.... done!
The data partition to be saved: sdd1 sdd2 sdd3
Activating the partition info in /proc... done!
Selected device [sdd1] found!
Selected device [sdd2] found!
Selected device [sdd3] found!
The selected devices: sdd1 sdd2 sdd3
Getting /dev/sdd1 info...
Getting /dev/sdd2 info...
Getting /dev/sdd3 info...
*****************************************************.
/usr/share/drbl/sbin/ocs-functions: line 9334: cryptsetup: command not found
/usr/share/drbl/sbin/ocs-functions: line 9334: cryptsetup: command not found
/usr/share/drbl/sbin/ocs-functions: line 9334: cryptsetup: command not found
*****************************************************.
*****************************************************.
*****************************************************.
*****************************************************.
*****************************************************.
*****************************************************.
Saving block devices info in /tmp/ocs_onthefly_src.9hdcnm/d2d-pseudo/blkdev.list...
Saving block devices attributes in /tmp/ocs_onthefly_src.9hdcnm/d2d-pseudo/blkid.list...
Checking the integrity of partition table in the disk /dev/sdd...
Reading the partition table for /dev/sdd...RETVAL=0
*****************************************************.
Saving the primary GPT of sdd as /tmp/ocs_onthefly_src.9hdcnm/d2d-pseudo/sdd-gpt-1st by dd...
34+0 records in
34+0 records out
17408 bytes (17 kB, 17 KiB) copied, 0.0403371 s, 432 kB/s
*****************************************************.
Saving the secondary GPT of sdd as /tmp/ocs_onthefly_src.9hdcnm/d2d-pseudo/sdd-gpt-2nd by dd...
32+0 records in
32+0 records out
16384 bytes (16 kB, 16 KiB) copied, 0.0179181 s, 914 kB/s
*****************************************************.
Saving the GPT of sdd as /tmp/ocs_onthefly_src.9hdcnm/d2d-pseudo/sdd-gpt.gdisk by gdisk...
The operation has completed successfully.
*****************************************************.
done!
Saving the MBR data for sdd...
1+0 records in
1+0 records out
512 bytes copied, 0.00241426 s, 212 kB/s
End of saveparts job for image /tmp/ocs_onthefly_src.9hdcnm/d2d-pseudo.
*****************************************************.
*****************************************************.
This image was saved successfully: d2d-pseudo
End of savedisk job for image d2d-pseudo.
Saving hardware info by lshw...
Saving DMI info...
Saving PCI info...
Saving OS info from the device...
Saving package info...
Saving image size info...
*****************************************************
*****************************************************
Checking if udevd rules have to be restored...
This program is not started by Clonezilla server, so skip notifying it the job is done.
Finished!
Generating a tag file for this image...
The mounted bitlocker device was not found. Skip unmounting it.
Now syncing - flush filesystem buffers...
Ending /usr/sbin/ocs-sr at 2024-08-30 09:22:25 EDT...
*****************************************************.
*****************************************************.
Cloning the source device to /dev/sdc. Running:
LC_ALL=C ocs-sr --ocsroot /tmp/ocs_onthefly_src.9hdcnm -l en_US.UTF-8 --batch -j2 -scr -p true -g auto -e1 auto -e2 -r -j2 -sfsck -k1 -icds ld2d_restoredisk d2d-pseudo sdc
Setting the TERM as linux
Starting /usr/sbin/ocs-sr at 2024-08-30 09:22:25 EDT...
Start preparing device name cache files in /tmp/ocs-cache//...
The file /proc/partitions remains the same. Skip generating disk(s) list file.
The file /proc/partitions remains the same. Skip generating partitions(s) list file.
Both /proc/partitions and blkid output do not change. Skip generating file system cache file related to the dev(s).
*****************************************************.
Clonezilla image dir: /tmp/ocs_onthefly_src.9hdcnm
*****************************************************.
Target disk sdc does not exist in the image saved from disk(s) "sdd".
Creating a tmp Clonezilla image "d2d-pseudo-tmp-cnvted" based on the image "d2d-pseudo" so that we can restore the image d2d-pseudo (was saved from sdd) to sdc...
///NOTE/// If the restored OS is GNU/Linux, you might have to modify /etc/fstab and grub config file in the restored GNU/Linux to affect these changes so that it can boot successfully!
Running: create-ocs-tmp-img -or /tmp/ocs_onthefly_src.9hdcnm d2d-pseudo d2d-pseudo-tmp-cnvted sdd sdc
Creating a temporary image based on image d2d-pseudo...
/tmp/ocs_onthefly_src.9hdcnm/d2d-pseudo/sdd1* was not found! Skip this!
/tmp/ocs_onthefly_src.9hdcnm/d2d-pseudo/sdd2* was not found! Skip this!
/tmp/ocs_onthefly_src.9hdcnm/d2d-pseudo/sdd3* was not found! Skip this!
Setting the TERM as linux
Clonezilla image dir: /tmp
*****************************************************.
Change sdd to sdc in /tmp/d2d-pseudo-tmp-cnvted/parts... done!
Change sdd to sdc in /tmp/d2d-pseudo-tmp-cnvted/sdd-pt.sf... done!
Change sdd to sdc in /tmp/d2d-pseudo-tmp-cnvted/dev-fs.list... done!
Change sdd to sdc in /tmp/d2d-pseudo-tmp-cnvted/blkdev.list... done!
Change sdd to sdc in /tmp/d2d-pseudo-tmp-cnvted/blkid.list... done!
*****************************************************.
Change sdd to sdc in /tmp/d2d-pseudo-tmp-cnvted/disk... done!
Change sdd to sdc in /tmp/d2d-pseudo-tmp-cnvted/sdd-pt.parted... done!
Change sdd to sdc in /tmp/d2d-pseudo-tmp-cnvted/sdd-pt.parted.compact... done!
Change sdd to sdc in /tmp/d2d-pseudo-tmp-cnvted/blkdev.list... done!
Change sdd to sdc in /tmp/d2d-pseudo-tmp-cnvted/blkid.list... done!
*****************************************************.
*****************************************************.
renamed '/tmp/d2d-pseudo-tmp-cnvted/sdd-chs.sf' -> '/tmp/d2d-pseudo-tmp-cnvted/sdc-chs.sf'
renamed '/tmp/d2d-pseudo-tmp-cnvted/sdd-gpt-1st' -> '/tmp/d2d-pseudo-tmp-cnvted/sdc-gpt-1st'
renamed '/tmp/d2d-pseudo-tmp-cnvted/sdd-gpt-2nd' -> '/tmp/d2d-pseudo-tmp-cnvted/sdc-gpt-2nd'
renamed '/tmp/d2d-pseudo-tmp-cnvted/sdd-gpt.gdisk' -> '/tmp/d2d-pseudo-tmp-cnvted/sdc-gpt.gdisk'
renamed '/tmp/d2d-pseudo-tmp-cnvted/sdd-gpt.sgdisk' -> '/tmp/d2d-pseudo-tmp-cnvted/sdc-gpt.sgdisk'
renamed '/tmp/d2d-pseudo-tmp-cnvted/sdd-mbr' -> '/tmp/d2d-pseudo-tmp-cnvted/sdc-mbr'
renamed '/tmp/d2d-pseudo-tmp-cnvted/sdd-pt.parted' -> '/tmp/d2d-pseudo-tmp-cnvted/sdc-pt.parted'
renamed '/tmp/d2d-pseudo-tmp-cnvted/sdd-pt.parted.compact' -> '/tmp/d2d-pseudo-tmp-cnvted/sdc-pt.parted.compact'
renamed '/tmp/d2d-pseudo-tmp-cnvted/sdd-pt.sf' -> '/tmp/d2d-pseudo-tmp-cnvted/sdc-pt.sf'
The created image is "/tmp/d2d-pseudo-tmp-cnvted".
Activating the partition info in /proc... done!
Creating partition in /dev/sdc...
Finding all disks and partitions..
Excluding busy partition.....................
Excluding linux raid member partition.....
Unmounted partitions (including extended or swap): sdc1 sdc2
Collecting info... done!
/usr/sbin/ocs-clean-disk-part-fs: line 65: pvs: command not found
Clean filesystem header in device /dev/sdc1...
/dev/sdc1: 8 bytes were erased at offset 0x00000052 (vfat): 46 41 54 33 32 20 20 20
/dev/sdc1: 1 byte was erased at offset 0x00000000 (vfat): eb
/dev/sdc1: 2 bytes were erased at offset 0x000001fe (vfat): 55 aa
Clean filesystem header in device /dev/sdc2...
/dev/sdc2: 2 bytes were erased at offset 0x00000438 (ext4): 53 ef
Cleaning RAID metadata in device /dev/sdc...
Running: dmraid -r -E /dev/sdc
/usr/share/drbl/sbin/ocs-functions: line 16010: dmraid: command not found
Running: dd if=/dev/zero of=/dev/sdc bs=512 seek=3907028144 count=1024
1024+0 records in
1024+0 records out
524288 bytes (524 kB, 512 KiB) copied, 0.166869 s, 3.1 MB/s
Clean filesystem header in device /dev/sdc...
/dev/sdc: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/sdc: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
Trying to clean the MBR and GPT partition table on the destination disk first: /dev/sdc
Informing the OS of partition table changes... done!
*****************************************************.
Running: dd if=/dev/zero of=/dev/sdc bs=512 count=1
1+0 records in
1+0 records out
512 bytes copied, 0.0150244 s, 34.1 kB/s
*****************************************************.
/usr/share/drbl/sbin/ocs-functions: line 3476: lvscan: command not found
Error: /dev/sdc: unrecognised disk label
Create the proportional partition table in /dev/sdc based on /tmp/d2d-pseudo-tmp-cnvted/sdc-pt.sf and the size of /dev/sdc...
Running: EXTRA_SFDISK_OPT="--force --wipe always" ocs-expand-gpt-pt -icds --batch /tmp/d2d-pseudo-tmp-cnvted/sdc-pt.sf /dev/sdc 2>&1
No initial MBR table on disk /dev/sdc. Create one now by:
LC_ALL=C parted -s /dev/sdc mklabel gpt
*****************************************************.
Size of original disk: 7814037168 sectors.
Size of target disk : 3907029168 sectors.
The ratio for target disk size to original disk size is .5000013544.
"EFI System partition" found. Not to expand this partition.
The last usable sector for this partition is 3907029134.
Changing the calculated partition size from 1953251499 to 1953251299.
The partition table to write in /dev/sdc:
*****************************************
label: gpt
label-id: 6E35A989-4A29-4E12-82CF-C76DF0033AFB
device: /dev/sdc
unit: sectors
first-lba: 34
/dev/sdc1 : start= 2048, size= 1048576, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=E70EA3C1-2B5C-4914-9A0E-DE9A386C2146, name="EFI System Partition"
/dev/sdc2 : start= 1050624, size= 1952727212, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=4927BDD7-3B7F-4B2D-BB20-6C2F25353A44, name="System"
/dev/sdc3 : start= 1953777836, size= 1953251299, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=DD13BE78-382D-4E01-A7AF-28086BEDDC64, name="Data"
*****************************************
Running: LC_ALL=C sfdisk --force --wipe always /dev/sdc >> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new GPT disklabel (GUID: 6E35A989-4A29-4E12-82CF-C76DF0033AFB).
/dev/sdc1: Created a new partition 1 of type 'EFI System' and of size 512 MiB.
/dev/sdc2: Created a new partition 2 of type 'Linux filesystem' and of size 931.1 GiB.
/dev/sdc3: Created a new partition 3 of type 'Linux filesystem' and of size 931.4 GiB.
/dev/sdc4: Done.
New situation:
Disklabel type: gpt
Disk identifier: 6E35A989-4A29-4E12-82CF-C76DF0033AFB
Device Start End Sectors Size Type
/dev/sdc1 2048 1050623 1048576 512M EFI System
/dev/sdc2 1050624 1953777835 1952727212 931.1G Linux filesystem
/dev/sdc3 1953777836 3907029134 1953251299 931.4G Linux filesystem
## Failure message
Filesystem volume name: System
Last mounted on: /
Filesystem UUID: f3c9b3ef-8f62-4f64-8565-a26640a017cb
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags: signed_directory_hash
Default mount options: user_xattr acl
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 122085376
Block count: 488311552
Reserved block count: 24415577
Overhead clusters: 7946188
Free blocks: 254270228
Free inodes: 117630915
First block: 0
Block size: 4096
Fragment size: 4096
Group descriptor size: 64
Reserved GDT blocks: 1024
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 8192
Inode blocks per group: 512
Flex block group size: 16
Filesystem created: Sun Jul 3 16:00:58 2022
Last mount time: Wed Aug 28 13:52:13 2024
Last write time: Thu Aug 29 13:08:06 2024
Mount count: 0
Maximum mount count: -1
Last checked: Thu Aug 29 13:08:06 2024
Check interval: 0 ()
Lifetime writes: 9 TB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 32
Desired extra isize: 32
Journal inode: 8
Default directory hash: half_md4
Directory Hash Seed: 4971f2f7-0fdd-4780-9c9b-c8eeaf6456f4
Journal backup: inode blocks
Checksum type: crc32c
Checksum: 0x8dc6a520
dumpe2fs 1.47.0 (5-Feb-2023)
dumpe2fs: Invalid argument while reading journal super block
Unable to read the contents of this file system!
Because of this some operations may be unavailable.
The cause might be a missing software package.
The following list of software packages is required for ext4 file system support: e2fsprogs v1.41+.
Any suggestions?
Asked by Mike Slinn
(263 rep)
Aug 30, 2024, 06:19 PM