RSS Subscription
Linux Howtos & Tutorials

Enter your email:

Delivered by


NOTE:New tutorials are from LinuxCareer.com

Poll

Do you own or wish to have iPhone?
 


Linux eBooks FREE Download
A guide to programming Linux kernel modules
Introduction to Linux - A Hands on Guide
A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

Linux: The Hacking Solution (v.3.0)

SQLite 3 with PHP Essential Training – Free Video Training Tutorials

This guide will introduce you to the world of GNU/Linux

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)

Advanced Bash-Scripting Guide

Set up, maintain, and secure a small office email server

Partner Linux Sites:
How-To.LinuxCareer.com
Jobs.LinuxCareer.com
TuxMachines
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
All For Linux

dd

Article Index
1. Name
2. Synopsis
3. Frequently used options
4. Examples

1. Name

dd [man page] - convert and copy a file

2. Synopsis

dd [OPERAND]... dd OPTION 

3. Frequently used options

if=FILE
read from FILE instead of stdin
of=FILE
write to FILE instead of stdout
count=BLOCKS
copy only BLOCKS input blocks

4. Examples

dd command can be use to backup master boot record. Backup MBR:

dd if=/dev/hda of=/mbrbackup.img bs=512 count=1 

Restore MBR:

dd if=/mbrbackup.img of=/dev/hda bs=512 count=1 

We can also create image from floppy disk. Create immage:

dd if=/dev/fd0 of=/my_floppy_image 

Restore image:

dd if=/my_floppy_image of=/dev/fd0 

dd also can manage conversions. We can convert all characters in file from lower case to upper case:

echo linux > commands.txt
dd if=commands.txt of=commands.caps conv=ucase

convert all characters in file from lower case to upper case
We can also use dd to backup entire partitions. In this example we backup entire partition and use gzip to compress image so final file will have smaller size. This way we can backup any possible filesytem. However there are couple problems with this approach:

  • backup image is too large
  • backup image can be restored only on partitions with the same size as the original partition Backup /dev/hda1 partition command example:
dd if=/dev/hda1 | gzip -c > backup_partition_image.dd.gz 

To restore this image we can use command:

cat backup_partition_image.dd.gz | gzip -d | dd of=/dev/hda1 

Share this linux post:

Submit dd in Delicious Submit dd in Digg Submit dd in FaceBook Submit dd in Google Bookmarks Submit dd in Stumbleupon Submit dd in Technorati Submit dd in Twitter
 
Comments for this page are closed !!!
Please visit our new Linux Forum for additional help or discussion.


Linux eBooks FREE Download