1

Hi I had a image of my old 8GB pendrive and I wanted to make an additional copy on a new USB 3.1 pendrive. it is also 8gb so when I used the restore disk image it says the image is 23 mb bigger than the disk. how do I fix this!

C.S.Cameron
  • 20,530
  • 12
  • 78
  • 125

1 Answers1

2

Truncate image file

Removes unwanted space from end of image file so image fits on smaller drive when flashed

Input

ubuntu@ubuntu:~$ cd /media/ubuntu/DATA/
ubuntu@ubuntu:/media/ubuntu/DATA$ fdisk -l DiskImageofsdd.img

Output

Disk DiskImageofsdd.img: 28.66 GiB, 30752636928 bytes, 60063744 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 82741D01-6511-4A8A-8FDF-52D8C165C178

Device Start End Sectors Size Type DiskImageofsdd.img1 1953 3906 1954 977K BIOS boot DiskImageofsdd.img2 3907 503906 500000 244.1M EFI System DiskImageofsdd.img3 505856 44578815 44072960 21G Linux filesystem DiskImageofsdd.img4 44578816 60061695 15482880 7.4G Microsoft basic data

Input (Removes Microsoft basic data partition).

ubuntu@ubuntu:/media/ubuntu/DATA$ truncate --size=$[(44578815+1)*512] NewDiskImageofsdd.img
C.S.Cameron
  • 20,530
  • 12
  • 78
  • 125