Go to Post I want you to get the right answer no matter what. - Al Skierkiewicz [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #61   Spotlight this post!  
Unread 06-04-2013, 00:02
rbmj rbmj is offline
Registered User
FRC #0612 (Chantilly Robotics)
Team Role: Alumni
 
Join Date: Apr 2011
Rookie Year: 2011
Location: DC Area/Fairfax County
Posts: 192
rbmj is a jewel in the roughrbmj is a jewel in the roughrbmj is a jewel in the rough
Re: Which Linux distributions do you use?

If you've mounted the ntfs partition correctly, you're good to go. As long as it's mounted, the concept of a partition is transparent to the userland tools. It'll write to it as if it's on the root and the filesystem driver will do the actual write. Most linux distributions have the proper support to write to ntfs enabled. If you can echo foo > bar, then you can dd.

And if you can't, it should stop you by giving you a permission denied message before it lets you do something that can nuke the partition. It's only "disk destroyer" if you start playing with outputting to files in /dev - that's the only time it actually writes bytes to raw disk - and really anything written to those files can be dangerous, just dd does it the most. They might be special files, but they're still just files, and dd doesn't do much of anything special - it just moves bytes around, like a really low-level cat.
__________________
FRC 612 '12
USNA '16

Last edited by rbmj : 06-04-2013 at 00:07.
  #62   Spotlight this post!  
Unread 06-04-2013, 15:07
flameout flameout is offline
AKA Ryan Van Why
FRC #0957 (SWARM)
Team Role: Alumni
 
Join Date: Sep 2009
Rookie Year: 2009
Location: Oregon
Posts: 168
flameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to allflameout is a name known to all
Re: Which Linux distributions do you use?

Quote:
Originally Posted by Ether View Post
dd if=/dev/sda of=/mnt/sdb1/MBR.img bs=512 count=1
Just to be 100% clear:

For the reasons explained by rbmj above, this command is perfectly safe.

The output file, /mnt/sdb1/MBR.img is a normal file -- it is not a device node, and does not control anything inside the kernel. Therefore, writing to it is a safe operation.

The underlying filesystem is sufficiently abstracted away such that dd is never aware it is writing to an NTFS partition -- it simply tells the kernel "put this data into this file", and the kernel deals with the filesystem itself.
  #63   Spotlight this post!  
Unread 06-04-2013, 17:03
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,042
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Which Linux distributions do you use?

Quote:
Originally Posted by flameout View Post
Just to be 100% clear:

For the reasons explained by rbmj above, this command is perfectly safe.
Quote:
Originally Posted by rbmj View Post
If you've mounted the ntfs partition correctly, you're good to go. As long as it's mounted, the concept of a partition is transparent to the userland tools
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


  #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.
  #65   Spotlight this post!  
Unread 08-04-2013, 11:59
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,620
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Which Linux distributions do you use?

There are also builds of dd for Windows.
My experiences with dd match those listed above.

dd for Windows
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:44.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi