LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   backup whole disk. (https://www.linuxquestions.org/questions/linux-newbie-8/backup-whole-disk-666893/)

ufmale 09-01-2008 12:32 PM

backup whole disk.
 
I have a 20G disk with bootable window 95 and there are 2-3 logical partition on the disk c:,d:,e: et.

I want to use the disk for something else and transfer all the data to
a bigger disk. However, There are a lot of tools/software that I may need to boot my computer with this disk in the future.

Is there an easy way to tool on linux to backup the whole thing?
Will I be able to restore it on a bigger drive?

I was looking in to the dd if=/dev/hda command. If I use that, will I be able to restore hda1,hda2 with dd, or do I need to create those partitions before restore it?

checkmate3001 09-01-2008 12:34 PM

To my knowledge you have to create the partitions and then dd each partition. Perhaps someone with more experience will be able to tell you for sure.

Quakeboy02 09-01-2008 12:54 PM

Here's a pretty comprehensive thread on the use of "dd":

http://www.linuxquestions.org/questi...ommand-362506/

If you use the dd command, check it several times before you actually hit the enter key.

Another way is to boot from Knoppix (or similar) and use "cp -axu /from /to" where "/from" and "/to" are drives you've mounted on knoppix. Then, install grub, of course.

The preferred way is probably using dd. There is lots of discussion in the dd thread, and lots of information.

Added:

Oops. As b0uncer pointed out, you have windows stuff, so you'll need to use dd.

b0uncer 09-01-2008 01:07 PM

If you want your Windows software to work after the copy operation, you need to use something like dd that makes one to one copy of the data; simply copying files may well result in the files being there but software not working (for example if Windows registry happens to be missing or wrecked). I'd guess what you want to do is dd the whole disk to another physical disk and if the new disk is bigger than the old (dd won't enlarge the image; if you copy 20GB to a 40GB disk, you'll seemingly be missing 20GB after that), after that resize the partition(s) to fill the disk. Don't get rid of the data in the old disk before you've made sure the new one works..

ufmale 09-01-2008 06:51 PM

It looks like I still do not get a solution. :)

What is other software I can use then? Is there a free software run on Windows if no tool available on Linux?

I did some searching on the Internet. I think the tool is called disk cloning. but i am still finding the one i can use. :)

Quakeboy02 09-01-2008 07:39 PM

Why can't you use "dd"?

/usr/darien 09-01-2008 08:15 PM

The software you seek is Clonezilla. http://www.clonezilla.org/

jschiwal 09-01-2008 08:50 PM

You could use dd to create a byte-by-byte image of the drive. On the new larger drive, partition it with the sizes you want. Then mount each partition from the image and simply copy all of the files over. Suppose that you use an external drive (don't use the fat32 filesystem) to save the image, and it is mounted on /media/disk/.

All of these commands are run as root.
Code:

dd if=/dev/sda bs=512 of=/media/disk/sda_backup.img
Next save the partition information in a file. ( Although it can be obtained from the image, it's still a good idea. )
Code:

fdisk -u /dev/sda >/media/disk/sda_partition_table.
You will need the starting offsets for each partition to be able to mount a partition on a disk image file, later, when you are ready to mount the partitions.

Code:

jschiwal@qosmio:~> sudo mkdir /mnt/part3
jschiwal@qosmio:~> sudo /sbin/fdisk -lu /dev/sda

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders, total 390721968 sectors
Units = sectors of 1 * 512 = 512 bytes
Disk identifier: 0xd1b42421

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1            2048    3074047    1536000    7  HPFS/NTFS
Partition 1 does not end on cylinder boundary.
/dev/sda2  *    3084480  150577244    73746382+  7  HPFS/NTFS
/dev/sda3      150577245  372659804  111041280    f  W95 Ext'd (LBA)
/dev/sda4      372666368  390721535    9027584  17  Hidden HPFS/NTFS
/dev/sda5      150577371  154786274    2104452  82  Linux swap / Solaris
/dev/sda6      154786338  216347354    30780508+  83  Linux
/dev/sda7      216347418  372659804    78156193+  83  Linux
jschiwal@qosmio:~> sudo /sbin/losetup -fs /dev/sda -o $((512*372666368))
/dev/loop0
jschiwal@qosmio:~> sudo mount -t ntfs /dev/loop0 /mnt/part3/
jschiwal@qosmio:~> sudo ls /mnt/part3/ | head -n 5
BIN
BOOT
BOOTMGR
DATA.INI
DMI.INI

If you do it as root, you don't need to run sudo. I need to really feel some pain before using "su -".


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