LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   syntax is everything... dd wrote to the main drive not the usb... (https://www.linuxquestions.org/questions/linux-newbie-8/syntax-is-everything-dd-wrote-to-the-main-drive-not-the-usb-4175440527/)

4n6 12-07-2012 10:53 PM

syntax is everything... dd wrote to the main drive not the usb...
 
Hello,
I am a little out of touch since it has been over 10 years since I played with UNIX, so I am very rusty on the commands… What I am trying to do is to install a copy of DEFT onto an usb drive. I thought I had the syntax correct but, while I was in the Ubuntu 11 side of my win7/Linux machine, I discovered how lucky I was to have a backup image of my hard drive since I ended up wiping the drive and installing DEFT onto the main drive and missing the USB stick… here is what I THOUGHT was the correct command:
dd if=DeftPen_v710-usb_4gb.dd of=/dev/sdb ; sync
this gave the permission error… so I tried:
sudo dd if=DeftPen_v710-usb_4gb.dd of=/dev/sdb ; sync
and it appeared to work… until I rebooted and discovered that I missed my pen dirve…
so, my questions are these:
1. What command will tell me my drive names?
2. How do I use the dd command to write to an unmounted drive? And what did I type wrong?
3. Ubuntu normally auto mounts new drives, how do I un mount it once it is plugged in? (I normally use the storage manager)
Thanks,
b

syg00 12-08-2012 01:01 AM

Congratulations on the backup - not many have such before they come asking for help.
Absolutely essential when screwing around with the system. Looks like you'll get plenty of pertinent practice at least .... :p

You had the correct syntax - you just picked the incorrect target (drive).
You may not be asking what you think you are asking, and even if you are you may not be asking the correct question(s). I'll try to be as flexible as possible with the answers.
1). This is not trivial from CLI. Operating systems present (and mount) partitions not devices (generally) - this applies to both Windoze and Linux. When you plug in the drive you should get notified, if not try "dmesg | tail -n 20" (no quotes - on any of my example commands). That should allow you to guess the drive - these days it'll be something like /dev/sd? (one character a/b/c ... ignore digits at end). "ls /dev/disk/" will tell you your drives, but will give no indication of whether they are in use.
2). The command was basically correct - as you indicated you hit the wrong device. The device may be named differently in different distros (Fedora may call it /dev/sda for example). So it's tough to give absolute answers. "dd" is both powerful and stupid - it'll do as you tell it to. No questions asked - online or offline, makes no difference.
3). Ubuntu mounts partitions. Use "df -hT" to see mounted partitions (correlate with the dmesg output), then use "umount /media/<whatever>" on all the entries that correspond to the device of interest. This time there will be a character (as above) plus a number for the partition(s) - I'm guessing on /media/... as I don't have a Ubuntu handy.
Given what you are doing, it is possible there won't be a partition on the USB at all, but that's a whole different can of worms.
From a GUI you should be able to right-click each partition to unmount it. I rarely use one for such.

malekmustaq 12-09-2012 11:04 AM

For an additional thought to the questions:

Quote:

1. What command will tell me my drive names?
Do in terminal <without quotes> -- " fdisk -l " or " parted -l " (all small letter ' L ' not number 1 ) or "cat /proc/mounts"

Quote:

2. How do I use the dd command to write to an unmounted drive? And what did I type wrong?
Simply dd if=/source/of_something of=/taget/drive

"if" means --Input File
"of" means --Output File

and read "man dd" for its manual in the terminal.

Quote:

3. Ubuntu normally auto mounts new drives, how do I un mount it once it is plugged in? (I normally use the storage manager)
1. From the GUI (desktop utility application) right click the Desk Mounter button; or from the Desktop right-click the mounted icon, click Unmount.

2. From the terminal: "sudo umount /dev/sd..." or use the mount point for the syntax "sudo umount /media/sd..."

There is no need to use DEFT. Just a terminal and the "dd" command.

Hope that helps.

Good luck.

4n6 12-10-2012 07:15 PM

Okay i finally got it, with a little help, but i got it working... and hopefully i wont have to re-install the images.

Thanks!!!


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