View Single Post
  #64   Spotlight this post!  
Unread 06-04-2013, 19:51
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Which Linux distributions do you use?

Quote:
Originally Posted by Ether View Post
What happens if the sdb1 target partition is accidentally not mounted? Will I just get an error message and no damage done? Or are all bets off, and no telling what dd might do?

dd if=/dev/sda of=/mnt/sdb1/MBR.img bs=512 count=1
There are two possible scenarios, depending on how you have /mnt set up -- either /mnt/sdb1 exists as a regular directory when you don't have anything mounted to it, or /mnt/sdb1 doesn't exist when nothing is mounted to it. In the first scenario, dd will create the file MBR.img in /mnt/sdb1/, but this will be on the root filesystem, not the ntfs filesystem. If /mnt/sdb1 doesn't exist, dd will complain with a message like this:
Code:
dd: opening `/mnt/sdb1/MBR.img': No such file or directory
The only times you have to worry about corrupting a filesystem are a) when you have faulty drivers (if you install them from an official repository they're pretty well tested) or b) when you're writing directly to the drive itself (eg. /dev/sdb or /dev/sdb1). If you successfully mount a filesystem, you are no longer accessing the raw drive, but instead accessing the actual files of the filesystem, as though the root of the drive were simply a subdirectory of /mnt/.
__________________
I code stuff.