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
  • 19,519
Sanjay
  • 11
  • Ubuntu 16.04 LTS has reached the end of it's standard support life thus is now off-topic here unless your question is specific to helping you move to a supported release of Ubuntu. Ubuntu 16.04 ESM support is available, but not on-topic here, see https://askubuntu.com/help/on-topic See also https://ubuntu.com/blog/ubuntu-16-04-lts-transitions-to-extended-security-maintenance-esm – guiverc Jun 30 '21 at 11:10
  • FYI: the easiest fix is to use a large 8gb thumb-drive; they are never exactly 8gb; the can vary a certain % so some are smaller than others (particularly if different brands/models).. Why did you tag an EOL/ESM and thus off-topic release? – guiverc Jun 30 '21 at 11:13
  • If there is any space left at the end of your old pendrive you can truncate the image file before flashing it to the new pendrive. for a hint how to do it see: https://askubuntu.com/a/1300542/43926 Item 2) or Google "linux truncate disk image". – C.S.Cameron Jun 30 '21 at 11:18

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
  • 19,519