Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Which Linux distributions do you use? (http://www.chiefdelphi.com/forums/showthread.php?t=114822)

rbmj 06-04-2013 00:02

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.

flameout 06-04-2013 15:07

Re: Which Linux distributions do you use?
 
Quote:

Originally Posted by Ether (Post 1257591)
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.

Ether 06-04-2013 17:03

Re: Which Linux distributions do you use?
 
Quote:

Originally Posted by flameout (Post 1257807)
Just to be 100% clear:

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

Quote:

Originally Posted by rbmj (Post 1257708)
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



Ginto8 06-04-2013 19:51

Re: Which Linux distributions do you use?
 
Quote:

Originally Posted by Ether (Post 1257822)
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/.

techhelpbb 08-04-2013 11:59

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


All times are GMT -5. The time now is 04:25.

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