LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 06-20-2008, 12:34 AM   #481
lawrence_lee_lee
Member
 
Registered: May 2007
Posts: 141

Rep: Reputation: 16

Thanks you very much, to AwesomeMachine. You've answered many of my doubts.

By the way, about the "conv=notrunc" problem, I asked that question because English is not my mother tongue, and I cannot understand some sentence structures. I really cannot get what exactly is about the "conv=notrunc" when the first time I read this thread. Another example is that in fact I don't quite understand what you answered me about the "encrypted drive" problem and the "overwritting free space" problem". Nevertheless, I understand your first four replies very clearly and in fact they are my most important questions. As for the others, I will leave them.

Once again, thank you very much!
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-24-2008, 06:15 PM   #482
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Original Poster
Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Post conv=notrunc

Quote:
Originally Posted by lawrence_lee_lee View Post
Thanks you very much, to AwesomeMachine. You've answered many of my doubts.

By the way, about the "conv=notrunc" problem, I asked that question because English is not my mother tongue, and I cannot understand some sentence structures. I really cannot get what exactly is about the "conv=notrunc" when the first time I read this thread. Another example is that in fact I don't quite understand what you answered me about the "encrypted drive" problem and the "overwritting free space" problem". Nevertheless, I understand your first four replies very clearly and in fact they are my most important questions. As for the others, I will leave them.
Once again, thank you very much!
The encryption password for an aes loop device is hashed into the file itself. Therefore, the password can never be changeD, nor recovered if lost.

Conv=notrunc means "Do not truncate the output file".
 
Old 07-21-2008, 12:55 PM   #483
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
To copy just the partition table, not the entire MBR:
Code:
dd if=/dev/$SOURCE of=$TARGET size=1 count=64 skip=446 seek=446
Ref: http://en.wikipedia.org/wiki/Master_boot_record

Last edited by archtoad6; 07-21-2008 at 12:56 PM. Reason: Change variable names for clarity
 
Old 07-30-2008, 10:46 PM   #484
digital8doug
Member
 
Registered: Aug 2006
Location: Near Binghamton, NY-the recent FLOOD zone
Distribution: Sabayon 351, Mepis8, oSuse11.3, Kubuntu8.1, Fed10, Slack12.1 #426299 RLU
Posts: 145
Blog Entries: 1

Rep: Reputation: 15
Question Copying MBR; why bs 446 vs 512. Storing on SDHC vs floppy or USB

Awesome information, but still not in Linux Answers unless I missed it. Found this from a Wiki.. link!

In one spot the instructions to copy MBR; bs is 512 (entire first sector of HD if I am understanding all this), but in same document (also in other original; Applications_GUI_Multimedia/How_To_Do_Eveything_With_DD?) the bs=446. Why ? What is the significance of the 66 difference ?

How do I save my GRUB (from MBR?) to an SDHC card [ of=/media/SDHC/MBR.boot ??) since Asus Gaming series LTs lack a floppy? Then if=/media/SDHC/MBR.boot of=/dev/sda as required to restore it when I screw something up!

Would like to zero out first part of SDA so I can install XP pro & Vista Premium 64 bit to an HD that already has openSuse 11.0 & Kubuntu 8.10 (in beta stages still) installed
 
Old 07-31-2008, 08:21 AM   #485
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
Quote:
Originally Posted by digital8doug View Post
In one spot the instructions to copy MBR; bs is 512 (entire first sector of HD if I am understanding all this), but in same document (also in other original; Applications_GUI_Multimedia/How_To_Do_Eveything_With_DD?) the bs=446. Why ? What is the significance of the 66 difference ?
Yes, 512 will copy the whole 1st sector, the MBR. 446 will copy only the boot code, see my MBR link, especially the last line in the table "Structure of a Master Boot Record":
MBR, total size: 446 + 64 + 2 = 512
Which you use depends on whether you want the partition table or just the boot code. If you're saving, that probably doesn't make much difference; but if you're restoring, it could be crucial.


Quote:
Originally Posted by digital8doug View Post
How do I save my GRUB (from MBR?) to an SDHC card [ of=/media/SDHC/MBR.boot ??) since Asus Gaming series LTs lack a floppy? Then if=/media/SDHC/MBR.boot of=/dev/sda as required to restore it when I screw something up!
In the following 2 code samples, I used the variables "N","GRUB", & SAVE_FILE to make actual dd lines shorter, more general & more easily changed, &, I hope, clearer. Since you asked to "save my GRUB", I used "N=446" to save & restore only the GRUB stage 1 boot code, not the partition table, too. Change that to "512" if you like, but be sure that's what you want to do.
Code:
N=446 
GRUB='/dev/sda';  SAVE_FILE=/media/SDHC/MBR.boot
dd if=$GRUB of=$SAVE_FILE bs=$N count=1
To restore, reverse 'if' & 'of':
Code:
N=446
GRUB='/dev/sda'; SAVE_FILE=/media/SDHC/MBR.boot
dd if=$SAVE_FILE of=$GRUB bs=$N count=1

Quote:
Originally Posted by digital8doug View Post
Would like to zero out first part of SDA so I can install XP pro & Vista Premium 64 bit to an HD that already has openSuse 11.0 & Kubuntu 8.10 (in beta stages still) installed
Assuming to want to wipe all Linux, not make a quad-boot installation.
<rant>
<severe flames omitted />
</rant>
I think this might be unnecessary, but I would:
Code:
dd if=/dev/zero of=$SDA bs=512 count=1
I believe that will make the disk appear blank to the M$ installer(s).
 
Old 08-19-2008, 04:08 AM   #486
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
I've taken non-technical posts of dubious content out of
the dd thread and slapped them into General. I'm afraid
I have better things to do than sieve through 24 pages of
a thread that should have been a Linux answer in the first
place, if people spot more posts in here that should be
gone, please report those individually.


Cheers,
Tink
 
Old 08-19-2008, 02:37 PM   #487
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Original Poster
Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Thanks Tink!

Last edited by AwesomeMachine; 08-19-2008 at 03:57 PM.
 
Old 08-21-2008, 11:47 AM   #488
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
Can this thread be made Sticky either on a Global or Personal basis. It will take some time to read and comprehend. During that time it would be handy if it showed up on the first page.
 
Old 08-21-2008, 01:05 PM   #489
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by john test View Post
Can this thread be made Sticky either on a Global or Personal basis. It will take some time to read and comprehend. During that time it would be handy if it showed up on the first page.
This has been requested a couple of times, and while
I appreciate that it's of great interest for some it's not
of great interest for the majority visiting LQ; so no, it
ain't happening. Just subscribe to the thread, and you
should be able to hunt it down easily.


Cheers,
Tink
 
Old 08-24-2008, 03:55 AM   #490
weetniks
LQ Newbie
 
Registered: Jul 2007
Location: Belgium
Distribution: ubuntu feisty fawn & dapper
Posts: 4

Rep: Reputation: 0
Great stuff . It's a pity there is no 'printer-friendly' version available ?
( using the print button in Firefox truncates the long lines . )
 
Old 08-27-2008, 09:45 AM   #491
weetniks
LQ Newbie
 
Registered: Jul 2007
Location: Belgium
Distribution: ubuntu feisty fawn & dapper
Posts: 4

Rep: Reputation: 0
Question Using the dd-tool on an extended partition ?

One of my drives contains an extended partition (/dev/sdb4) :
- in it are two logical partitions :
-- one of them (sdb5) being my /home partition
-- the other sdb6 is an NTFS partition
-- the remaining of the sdb4 partition is still unallocated ( 127 gb )

What is the best policy to backup this extended partition with dd , how to save the partition-table(s) , how to avoid backing up the unallocated area or is this space unreachable by default ??
Can dd be used to backup and restore a single logical partition ?
A lot of questions , I know .
Extended partitions still have an esoteric aspect to me.
Thanks for the help .
weetniks on Ubuntu Hardy Heron
belgium
 
Old 08-28-2008, 03:06 AM   #492
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Original Poster
Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Since many members, and even some of the mods request this post to be stickied, I'll give my opinion. Sticky posts should be reserved for posts that practically everyone who enters the forum would benefit from reading. The DD post is a good post, but I don't think it is worthy of a sticky.

Because I haven't previously suggested this, I will advise users who wish to have this post in a convenient place, to bookmark it. The URL for the post doesn't change, that I'm aware of. If this is impossible for some reason, members searching for this post may use the advanced search function, search for posts with the word, 'Learn', in the title, search only titles, and only posts made by AwesomeMachine.

This narrows the number to only a few. It isn't difficult to find this one, and you just click on the link, and it brings you right here.
 
Old 08-28-2008, 03:27 AM   #493
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Original Poster
Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Smile

Quote:
Originally Posted by weetniks View Post
One of my drives contains an extended partition (/dev/sdb4)

-- in it are two logical partitions :
-- one of them (sdb5) being my /home partition
-- the other sdb6 is an NTFS partition
-- the remaining of the sdb4 partition is still unallocated ( 127 gb )

What is the best policy to backup this extended partition with dd , how to save the partition-table(s) , how to avoid backing up the unallocated area or is this space unreachable by default ??
Can dd be used to backup and restore a single logical partition ?
A lot of questions , I know.
PC hard drives are limited to 4 primary partitions. There are only enough bytes for 4 partitions in the Master Boot Record, or sector 1 of the HDD. But, the drive only needs 1 primary partition, and the other 3 partitions can be made logical.

Within a logical partition entry, is a pointer to where the logical partition is located on the drive. Within this location is logical partition table, that describes the logical drives within the logical (or extended), partition.

There is a limit to how many logical drives there can be in a logical partition, but it isn't a realistic limitation.

When one uses dd, he makes verbatim copies of filesystems. I don't think it would work to use dd on a logical partition, and have it duplicate all the logical file systems. You would want to use the logical drive devices, specified to dd.

Device Boot Start End Blocks Id System

/dev/sdb1 1 13 104391 83 Linux
/dev/sdb2 * 14 2180 17406427+ 83 Linux
/dev/sdb3 2181 8554 51199155 83 Linux
/dev/sdb4 8555 14495 47721082+ 5 Extended
/dev/sdb5 8555 14176 45158683+ 83 Linux
/dev/sdb6 14177 14495 2562336 83 Linux

You would not use /dev/sda4, but rather /dev/sda5 and /dev/sda6, within /dev/sda4. Because the unallocated space is not part of a file system, it will not be duplicated, unless you specify /dev/sda4, in the above example.
 
Old 08-28-2008, 04:34 AM   #494
somedeveloper
LQ Newbie
 
Registered: Aug 2008
Posts: 1

Rep: Reputation: 0
> How to make a bootable CD from a bootable floppy
> Put the floppy in the floppy drive, and don't mount it.
> dd if=/dev/fd0 of=/home/sam/floppy.img

Hey AwesomeMachine, I found your article incredibly useful! Didn't quite follow why we need to unmount the floppy drive above. Would you reply back, or alternatively, include inline a few words on the whys of it? Many thanks!
 
Old 08-28-2008, 08:26 AM   #495
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Original Poster
Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Post Need to unmount floppy image ...

Quote:
Originally Posted by somedeveloper View Post
> How to make a bootable CD from a bootable floppy
> Put the floppy in the floppy drive, and don't mount it.
> dd if=/dev/fd0 of=/home/sam/floppy.img

Hey AwesomeMachine, I found your article incredibly useful! Didn't quite follow why we need to unmount the floppy drive above. Would you reply back, or alternatively, include inline a few words on the whys of it? Many thanks!
I made a slight adjustment to the OP. There are several reasons. The best one is that files mounted as loop devices are not simultaneously available as files.
 
  


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



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 04:22 AM
The best way to learn? iz3r Programming 7 02-06-2005 11:00 PM
Best way to learn Linux from the command line patpawlowski Linux - General 2 03-01-2004 03:37 PM
I want to learn C. KptnKrill Programming 14 12-18-2003 01:03 PM
Best way to learn.... InEeDhElPlInUx Linux - Newbie 5 10-11-2003 01:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:19 PM.

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
Open Source Consulting | Domain Registration