LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 09-27-2006, 04:22 PM   #226
kniwor
Member
 
Registered: Aug 2005
Distribution: Slackware 12
Posts: 106

Rep: Reputation: 15

lol... if there were such wonderful commands for windows/dos, it would not be windows, and one would not have to spend a fortune for purchasing acronis true image.....
 
Old 09-28-2006, 11:49 PM   #227
swdamle
LQ Newbie
 
Registered: Dec 2004
Location: pune,India
Posts: 4

Rep: Reputation: 0
Hello Sir,

This has reference to the web page: "How To Do Eveything With DD -.htm"

> "Make an iso image of a CD"

Done every thing as under,

-------------------------------------------------------------------------------------------------------------------------------------------
knoppix@localhost:~$ su
Password:
root@localhost:/home/knoppix# dd if=/dev/cdrom of=mycd.iso bs=2048 conv=notrunc
358254+0 records in
358254+0 records out
733704192 bytes transferred in 354.825077 seconds (2067791 bytes/sec)
root@localhost:/home/knoppix#

mycd.iso has permissions-rw-r--r--)to chage the permissions:
root@localhost:/home/knoppix# chmod a+rwx mycd.iso
root@localhost:/home/knoppix#
Now mycd.iso has permissions-rwxrwxrwx)

to mount the image,
root@localhost:/home/knoppix#mkdir /mnt/mycd
root@localhost:/home/knoppix#

root@localhost:/home/knoppix#kedit /etc/fstab
added the line /home/knoppix/mycd.iso /mnt/mycd iso9660 rw, user, noauto 0 0 and saved it.

root@localhost:/home/knoppix# mount -o loop /mnt/mycd
root@localhost:/home/knoppix#

The file system IS available as files & directories.
---------------------------------------------------------------------------------------------------------------------------------------------

however sorry to inform you that,

can NOT edit "mycd.iso" as it gets mounted with "-r-xr-xr-x" permissions!

Prof S W Damle

Email : swdamle@sancharnet.in
________________________________________________________________________
 
Old 09-29-2006, 02:19 AM   #228
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,005
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Even if you COULD edit the file, it wouldn't be a valid iso afterwards.

You CANNOT directly edit a loop-back mounted ISO image, you have to copy
the file-system, work on that, and create a new ISO.


Cheers,
Tink
 
Old 10-02-2006, 03:54 PM   #229
idamien
LQ Newbie
 
Registered: Oct 2006
Posts: 10

Rep: Reputation: 0
Backup of /dev/sda over network to share

Hi,

Thanks so much for all that info on DD...

Im trying to make a backup of a whole SATA disk over a network to a share on another computer.
The share is larger than the disc being copied and Im gzipping it. This is the command Im using:

dd if=/dev/sda ibs=4096 | gzip --best > /media/backup/Recovery.gz

/media/backup is where I mounted the share and Im using Knoppix 5.0.1.

DD works fine until it reaches a file size of ~2GB when it stops accusing a file size limit error. Im guessing this is a network protocol limit... Is this right?

How can I change this mine command to split the resulting gzipped file into regular sized files (like 700MB, 2GB, etc.)?

Thanks for reading and trying to help...
 
Old 10-03-2006, 07:59 AM   #230
idamien
LQ Newbie
 
Registered: Oct 2006
Posts: 10

Rep: Reputation: 0
Hi again...

I myself found a solution for my question. If this may help someone, heres a command to use when completeley raw imaging a SATA HDD, compressing it with gzip, and splitting it in files, all going over a network to a share on a remote PC:

dd if=/dev/sda | gzip --best | split -b 2000m /media/backup/Recovery

This was done using Knoppix 5.0.1. I first mounted the network share on /media/backup/. The split parameter

-b 2000m

tells split to split the file in 2.000 MB (2.048.000 KB) ant the parameter

/media/backup/Recovery

is the base destination file. Split created in this case Recoveryaa, Recoveryab, Recoverac, etc...

I hope this can help someone as I need help now ...

Upon running this command I found that dd does a COMPLETE (in all senses) raw image of the device, that is, including empty areas of the HDD, which is precisely what I do not need...

So, is there any way to make a raw image of only used clusters/chunks/bytes/whatever but still preserving the whole of the disk structure and partitioning and MBR???

Please help, anyone?
 
Old 10-03-2006, 08:06 AM   #231
idamien
LQ Newbie
 
Registered: Oct 2006
Posts: 10

Rep: Reputation: 0
Ooops... small correction, the command is actually:

dd if=/dev/sda | gzip --best | split -b 2000m - /media/backup/Recovery
 
Old 10-03-2006, 09:04 AM   #232
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
Personally I feel dd is being misused if a user wants a sector-to-sector transfer but does not wish to include empty area entries. In such a case there are many Linux back up programs, like cp, tar, rsync, that work with the filing system and by default will not back up empty space.

If a user has an interest to copy the MBR both Lilo (by lilo -b) and Grub (by grub-install) can mirror the image of the MBR in any partition or in a floppy. What is more any boot loader can be restored. For MS system it is by just a Dos floppy (with fdisk.exe inside) or the system installation CD. A Linux's boot loader can be restored by any Live CD or its installation CD that has a rescue option.

Regarding the partition table I just keep a record of its sizes and types of the partitions. Sometimes I accidentally lost between 55 to 60 partitions in a disk (about a dozen times) but all can be rebuilt without losing a single byte, as the content inside the partitions will not be damaged even the entire partition table is nuked.

I think dd is a hardware-type back up and is the only one that copies the boot sector of each partition so it should be used when such a need is required, as by itself it doesn't compress the data even the whole disk is empty. As it doesn't deal with the filing system but faithfully duplicates the hard disk sector by sector it is ideally suitable to clone disk with different filing systems or different operating systems.

Last edited by saikee; 10-03-2006 at 11:12 AM.
 
Old 10-03-2006, 09:48 AM   #233
idamien
LQ Newbie
 
Registered: Oct 2006
Posts: 10

Rep: Reputation: 0
Oh, Saikee, Im so sorry if I offended you. I assure I didnt and dont mean do "abuse" anyone or anything.

Thanks anyway for your (to me useless) reply. Maybe you should have considered the possibility that Im a newbie to Linux (as I am).

Anyway, my second attempt is to backup the MBR of the disk using dd and copying the SATA partition (theres only one) using cp or tar. Either way I go I need two things: (1) the ability to split the copied and compressed files into regular sized files and (2) the ability to recover my disk by first recovering the MBR with dd and then by uncompressing the compressed files to /dev/sda1.

Is this all I need to do? Is this feasible? Please answer constructively and dont use this forum as an outlet for your misdirected anger.

Thanks.
 
Old 10-03-2006, 11:12 AM   #234
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 112Reputation: 112
I regret the use of the word "abuse" and the correct word should have been "misuse" becuase that is what it appears to me on technically ground. I have since altered it. It is like using a chisel as a screwdriver. Yes one can use it that way but a chisel is better used for cutting wood.

If you want to save a copy of Grub, just slip a floppy into the drive, click terminal and type
Code:
grub-insall /dev/fd0
If your Linux uses Lilo then it is just a line of
Code:
lilo -b /dev/fd0
Should at any future date you nuke your MBR then put the floppy in will boot up the Linux. Repeating the above command with "fd0" replaced by "sda" will write the stored MBR back to your Sata.

Furthermore you can have the Linux unbootable, say after accidental losing the MBR, boot up the PC with a Linux Live CD, mount your Linux partition and charge root into it and you will be inside the unbootable Linux. Once inside it you can repeat the above statements to restore the MBR. Don't waste time to compress just 512 bytes of the MBR. Just get hold of any Live CD and learn how to get inside an unbootable Linux.

Most of the detials are documented in the last link of my signature.

Last edited by saikee; 10-03-2006 at 11:17 AM.
 
Old 10-03-2006, 10:06 PM   #235
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
OK, enough

Quote:
Originally Posted by idamien
Oh, Saikee, Im so sorry if I offended you. I assure I didnt and dont mean do "abuse" anyone or anything.

Thanks anyway for your (to me useless) reply. Maybe you should have considered the possibility that Im a newbie to Linux (as I am).

Anyway, my second attempt is to backup the MBR of the disk using dd and copying the SATA partition (theres only one) using cp or tar. Either way I go I need two things: (1) the ability to split the copied and compressed files into regular sized files and (2) the ability to recover my disk by first recovering the MBR with dd and then by uncompressing the compressed files to /dev/sda1.

Is this all I need to do? Is this feasible? Please answer constructively and dont use this forum as an outlet for your misdirected anger.

Thanks.
There is a method using netcat to dd between machines using ip address and port. If you read the whole OP you will see it. Some kernel versions, and file systems have a 2 GB file size limit, but dd does not have such a limit because files don't matter to dd. Dd doesn't even care if the drive is mounted or not. Use netcat, or nc to image the drive, and image it as a file. Like this:
On source machine

dd if=/dev/hda bs=16065b | gzip | netcat 192.168.1.1 1234
where 192.168.1.1 is the ip of the target and 1234 is the port.

Hit enter on Target machine first:

netcat -l -p 1234 | dd of=/home/sam/partition.img bs=16065b
Bs=16065b means the byte size is 255 (heads) x 63 (sectors per track) = (16065) x 512 (bytes per sector, b) , which is exactly one cylinder. Since only complete cylinders can be contained in a partition, and partitions will always will always have a whole number of cylinders it is safe to assume this particular bs= will copy the entire partition. If you have a file size barrier you should get rid of it, not split the file. Only old kernels and bad filesystems have a 2 GB limit.
 
Old 10-03-2006, 10:50 PM   #236
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
Quote:
Originally Posted by prashant.gupta
This article on dd command is very nice. Can we get the dd command for windows/dos?
There is a "dd" for Windows and DOS. It isn't quite as full featured as the UNIX version, but it will do many of the same things.
 
Old 10-05-2006, 09:09 AM   #237
idamien
LQ Newbie
 
Registered: Oct 2006
Posts: 10

Rep: Reputation: 0
Hi again,

Actually, I have been able to do the first half of my task (apparently). I used the following commands after booting a live CD Knoppix v5.0.1, to bakcup a Windows XP MCE 2005 SP2 harddisk to a network share (also Windows XP SP2):

su

mkdir /media/backup

mount //microsoft-pc/root /media/backup

mount /dev/sda1 /media/sda1

tar --create --preserve-permissions --recursion --gzip /media/sda1 | split -b 2000m - /media/backup/recovery.

dd if=/dev/sda of=/media/backup/mbr.dd bs=446 count=1


My only doubt has been the last line... Shouldnt bs read bs=512? I got this example line of script right here in this thread (checkout page 1) but am somewhat unsure about it. Can anyone help?

For the second half Im going to burn the recovery.* files onto the root of a DVD Live Distribution (Im thinking about using SLAX, any suggestions...?) and also the following script which Ill link to with an icon on the desktop so Ill have One-Click recovery. Im assuming it is a correct command and that all recovery.* files will be on the root dir of the same DVD disc. Please remember Im a newbie. OK, so here it goes:

su

dd if=/media/cdrom/mbr.dd of=/dev/sda bs=446 count=1

mount /dev/sda1 /media/sda1

dir --sort=extension /media/cdrom/recovery.* | cat | tar --extract --same-permissions --overwrite --ungzip /media/sda1


Is this right? Will it work? Again Im in doubt about the bs option of dd and wether I need a reboot after the dd command... Also Im piping from a dir command to a cat (I assume it concatenates binary files split with SPLIT) command and from that to the tar --extract...

Is this right? Will this work? Please any comments and suggestions are more than welcome.

Thanks.
 
Old 10-05-2006, 10:18 AM   #238
idamien
LQ Newbie
 
Registered: Oct 2006
Posts: 10

Rep: Reputation: 0
Hi again,

Just tested my last post commands for recovery and found some bugs...

The DIR and LS commands, when piping to CAT, output text and CAT creates a text file with the name listing of the recovery files...

So, after a little meddling, I found this sequence of commands to work (apparently) correctly:

su

dd if=/media/cdrom/mbr.dd of=/dev/sda bs=446 count=1

mount /dev/sda1 /media/sda1

cat /media/cdrom/recovery.* | tar --extract --same-permissions --overwrite --ungzip --directory=/media/sda1


Having the same basename, CAT orders the input files by extension and successfully feeds it to TAR.

However, I found that: (1) the dd command to restore the MBR works and (2) although it works if you are creating an identical partition table to what you had previously (my case), the files on the partitions (I have only one) remain! Ive tested a reboot after the DD command but it was of no use: the files are still there and the TAR command to restore from the archive cant overwrite them (even though Im using the --overwrite option) accusing, for each file/directory, an error something like:

/dev/sda1/filename.blahblahblah: cant change permissions to rwxrwxrwx: cant overwrite.

Its not EXACTLY this but its something to this effect...

So, maybe I need to format the partition after the DD MBR restore command? Right? How do I go about doing that? Ive tried FORMAT --help (doesnt exist) and FDISK --help (exists but only partitions) and even FORMATD --help (silly attempt, doesnt exist either) but I cant seem to find a command to format partitions in Knoppix Live CD v5.0.1...

Any help, anyone, please?

I think my recovery script should look something like this:

su

dd if=/media/cdrom/mbr.dd of=/dev/sda bs=446 count=1

mount /dev/sda1 /media/sda1

formatcommand -partitiontypeoption ntfs -quickformatoption /dev/sda1

cat /media/cdrom/recovery.* | tar --extract --same-permissions --overwrite --ungzip --directory=/media/sda1


So, what do you think?

Thanks for reading and trying to help...
 
Old 10-05-2006, 11:46 AM   #239
idamien
LQ Newbie
 
Registered: Oct 2006
Posts: 10

Rep: Reputation: 0
Hi,

I found the format command... I think.

Now, right after DD, Im using:

mkntfs --quick /dev/sda1

It apparently quickformats correctly /dev/sda1.

But heres another issue Im getting. Apparently its from my lack of experience with TAR. When using TAR the files are being extracted to /dev/sda1 to the folder they were in Windows (their full path in Windows) INSIDE a folder called /media/sda1 (which is the folder I mounted the files on when creating the backup). For example, autoexec.bat is being extracted to /dev/sda1 to the following folder/filename:

/media/sda1/autoexec.bat

My first thought was that this was the --directory option, but I removed it and it continues to do so. Also, Im getting for MANY of the files the following error:

tar: /media/sda1/ORIGINAL_WINDOWS_FULL_PATH_HERE/filename.ext: Cannot open: Operation not supported

Can someone please help???

Thanks.
 
Old 10-07-2006, 05:55 AM   #240
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Original Poster
Rep: Reputation: 162Reputation: 162
Smile Thread hijacking

Quote:
Originally Posted by idamien
Hi,

I found the format command... I think.

Now, right after DD, Im using:

mkntfs --quick /dev/sda1

It apparently quickformats correctly /dev/sda1.

But heres another issue Im getting. Apparently its from my lack of experience with TAR. When using TAR the files are being extracted to /dev/sda1 to the folder they were in Windows (their full path in Windows) INSIDE a folder called /media/sda1 (which is the folder I mounted the files on when creating the backup). For example, autoexec.bat is being extracted to /dev/sda1 to the following folder/filename:

/media/sda1/autoexec.bat

My first thought was that this was the --directory option, but I removed it and it continues to do so. Also, Im getting for MANY of the files the following error:

tar: /media/sda1/ORIGINAL_WINDOWS_FULL_PATH_HERE/filename.ext: Cannot open: Operation not supported

Can someone please help???

Thanks.
idamien,

You have hijacked this thread. And I mean that in the nicest possible way. Please either keep your posts pertinent to the OP, or start a new thread. You can read about thread hijacking here:

http://www.linuxquestions.org/questi...89#post2453289
 
  


Reply

Tags
backup, best, clonezilla, cloning, command, data, dd, disk, drive, duplicate, erase, explanation, formatting, ghost, hard, image, iso, memory, ping, popular, recover, recovery, rescue, search, security, stick, upgrade, usb, wipe


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Learn The DD command AwesomeMachine Linux - Newbie 17 08-17-2006 05:22 AM
The best way to learn? iz3r Programming 7 02-07-2005 12:00 AM
Best way to learn Linux from the command line patpawlowski Linux - General 2 03-01-2004 04:37 PM
I want to learn C. KptnKrill Programming 14 12-18-2003 02:03 PM
Best way to learn.... InEeDhElPlInUx Linux - Newbie 5 10-11-2003 02:02 AM


All times are GMT -5. The time now is 01:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration