Does an image backup need to end in .img?

0

I'm using pv on Cygwin to backup an SD card to an image. I'm using pv over dd primarily for the ETA percentage that it offers by default.

pv /dev/sdc > /cygdrive/B/Users/Hashim/Desktop/SDBackup

My question is whether SDBackup will be a sufficient image that I can then use dd or pv to restore from to the SD card, or whether I should have specified SDBackup.img instead?

In other words, do dd/bash/Cygwin need the .img extension? It's always been my understanding that they don't, but I've recently been confused by other sources that include the .img. Am I correct in suspecting they do this purely for compatibility reasons so that the resulting image can be used with other utilities, or is there more to it?

Hashim

Posted 2018-02-02T00:57:15.867

Reputation: 6 967

I don’t think the .img extension will do anything magical. It should simply be there as a convenience for you to be able to recognize it later on if/when you come across the file yet don’t immediately recall what it is. – JakeGould – 2018-02-02T03:46:14.360

Answers

3

The filename is entirely arbitrary. Using .img is a useful convention which may be recognised by some other programs, but DD does not care.

While it's by no means required, putting an extension is a good idea as generally an extension differentiates a file from a directory (again, a convention, OS's do not require it)

davidgo

Posted 2018-02-02T00:57:15.867

Reputation: 49 152

1Accepted, but I think it may be more accurate to say that UNIX-based OSes don't require it, as Windows will render files without extensions unusable. – Hashim – 2018-02-02T22:36:59.427

@Hashim - I confess my expertise lie outside Windows, but it I'm fairly sure you can manipulate files without extensions fine in Windows - as long as you don't expect a program to recognise what type of file it is. The NTFS and FAT filesystems have on problem differentiating between files and directories where files are without extensions. To a lesser degree the same can be said of Linux - save that Linux can read the first line to see how to execute it (if it's set executable) – davidgo – 2018-02-03T00:18:46.677