Go Back   MEPISlovers Forum > Help > Regulars
Register FAQTop Statistics Today's Posts Donate Gallery
Gallery
Mepis Art Gallery
My images
Upload an image
View all users images
Post New Thread  Reply
How to clone a NTFS partition from Mepis 6.5

 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-21-2007, 10:44 AM
ko's Avatar
ko ko is offline
Whatever
 
Join Date: Jul 2006
Location: Netherlands
Gender: Male
Posts: 5,369
Thanks: 538
Thanked 2,007 Times in 1,220 Posts
Rep Power: 222
Reputation: 11933
ko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond repute
Default How to clone a NTFS partition from Mepis 6.5

Hi,

Cloning your Windows ntfs partition - from Mepis 6.5.
==============================

You probably already know that Mepis 6.5 has the capability to read/write from and to your Windows NTFS partitions (thanks to ntfs-3g).
This is a very nice feature for those with a dualboot system involving Windows.
But there's more news in that specific area, even if it has not been really brought up sofar........:
Mepis 6.5 also has ntfsprogs installed by default.

Have a look at : http://wiki.linux-ntfs.org/doku.php?id=ntfsprogs for details.
Ntfsprogs does consist of a wide selection of ntfs related utilities, and one of them is ntfsclone.
And ntfsclone is a nice tool to make backups of and restore NTFS-partitions.

Have a look here: http://wiki.linux-ntfs.org/doku.php?id=ntfsclone for details.

What does ntfsclone do?
==============

Ntfsclone is a utility for making backups -and restoring backups- of your working NTFS Windows-partition - from within Mepis.
You could say that the linux 'dd' command can do that too. Except for the fact that 'dd' will also copy non-allocated (empty) blocks, making the backup image just as large as the original ntfs partition. And compressing the bit-for-bit 'dd-image' will not significantly reduce its size, especially not when these non-allocated blocks still contain the remains of (for instance) long deleted multimedia files.

Clever Backups.
=========

Now....how does ntfsclone handle this in a more clever way?
The ntfs tool knows the internal structures of NTFS and is able to completely skip empty blocks. Its backup image may therefore be just a bit larger than the combined size of the actual files being backed-up and some filesystem meta-data. An optimal image-size can be achieved when you delete the Windows swapfile in Windows before making the ntfsclone backup in Mepis.

How to make a backup?
==============
Regular:
If you want to make a backup called hda1.ntfs of the filesystem on the NTFS partition /dev/hda1 then do as follows:
Open a konsole and type:

ntfsclone -s -o hda1.ntfs /dev/hda1

Compressed:
In order to further reduce the image filesize you can compress files at the same time. You do this by piping the output of the command to gzip, instead of directly to the imagefile:

ntfsclone -s -o -- /dev/hda1 | gzip -c > hda1.ntfs.gz

A fresh Windows installation with some installed programs will backup this way to an image file of around 600-800 MB

Compressed AN Splitted:
If you want to backup larger ntfs partitions (like 4-5 GB or more), for instance to an USB-harddisk that has been FAT32 formatted -which will require a filesize limit of slightly less than 4 GB- or to a writeable DVD you will probably need to also split the compressed imagefile. That can be done in an added pipelined command:

ntfsclone -s -o /dev/hda1 | gzip -c | split -a 3 -b 700m - hda1.ntfs.gz

The result will be backup-files of size 700 MB with names ranging from hda1.ntfs.gz.aaa through hda1.ntfs.gz.zzz

How to restore a backup?
===============

First you need to make sure that you do have an NTFS partiton of AT LEAST equal size as your (total of) uncompressed imagefile(s).
That NTFS partition may be empty (or just reformatted), or contain data (which will then be overwritten)..
Note: Please note before doing the backup how much space will be needed if you plan to use this scenario....

Regular:
The easiest method is of course restoring an uncompressed image. Use the letter O (capital O) instead of the (lowercase letter) o :

ntfsclone -r -O /dev/hda1 hda1.ntfs

Compressed:
If the image been compressed using gzip then you will need to reverse the pipeline:

gunzip -c hda1.ntfs.gz | ntfsclone -r -O /dev/hda1 -

Compressed and Splitted:
Splitup imagefiles can be joined by cat:

cat hda1.ntfs.gz.* | gunzip -c | ntfsclone -r -O /dev/hda1

Additional tool in ntfsprogs
================
If you have restored the image to a MUCH bigger partition you can (after the first start of Windows) resize it.
Just boot up you livecd and issue the command:

ntfsresize /dev/hda1

and expand the NTFS filesystem to fit the actual size of the partition.

Regards, Ko
__________________
Ko Bros

Last edited by Eadwine Rose : 04-21-2007 at 02:10 PM.
Reply With Quote
The Following 10 Users Say Thank You to ko For This Useful Post:
  #2  
Old 04-21-2007, 02:11 PM
Eadwine Rose Eadwine Rose is offline
MEPIS Guide
 
Join Date: Jul 2006
Location: The Netherlands
Gender: Female
Posts: 3,031
Thanks: 153
Thanked 380 Times in 296 Posts
Rep Power: 100
Reputation: 2048
Eadwine Rose has a brilliant futureEadwine Rose has a brilliant futureEadwine Rose has a brilliant futureEadwine Rose has a brilliant futureEadwine Rose has a brilliant futureEadwine Rose has a brilliant futureEadwine Rose has a brilliant futureEadwine Rose has a brilliant futureEadwine Rose has a brilliant futureEadwine Rose has a brilliant futureEadwine Rose has a brilliant future
Default

Made it a sticky for you Ko :)
__________________


Registered Linux user #375470
SimplyMEPIS 8.0-32 2.6.27-1-mepis-smp #1 SMP PREEMPT i686 GNU/Linux
Dual boot with W2K Pro * ASRock P4S61 / 1024Mb DDR * 2,67GHz Intel Celeron D * 81,96Gb Maxtor 6Y080L0 * 22" Samsung SyncMaster P2250 * SiS661FX 64MB (not in use) ATI RADEON 9550 AGP8 256MB * SiS AC'97 sound controller SI7012 Audio * SiS900 PCI Fast Ethernet * Logitech E3500 webcam * HP Scanjet 2400 (not supported) / DeskJet 840C * KDE 3.5.10

In Memoriam Dixie: 1-6-1991 - 4-10-2009
Reply With Quote
  #3  
Old 04-21-2007, 02:19 PM
Adrian's Avatar
Adrian Adrian is online now
are you talking to me?
 
Join Date: Jul 2006
Gender: Male
Posts: 8,832
Thanks: 998
Thanked 2,355 Times in 1,471 Posts
Rep Power: 268
Reputation: 13061
Adrian has a reputation beyond reputeAdrian has a reputation beyond reputeAdrian has a reputation beyond reputeAdrian has a reputation beyond reputeAdrian has a reputation beyond reputeAdrian has a reputation beyond reputeAdrian has a reputation beyond reputeAdrian has a reputation beyond reputeAdrian has a reputation beyond reputeAdrian has a reputation beyond reputeAdrian has a reputation beyond repute
Default

That's pretty cool howto, thaks Ko.
Reply With Quote
  #4  
Old 06-20-2007, 08:06 PM
cam34 cam34 is offline
MEPIS Guide
 
Join Date: Aug 2006
Location: En Zed
Posts: 309
Thanks: 22
Thanked 87 Times in 46 Posts
Rep Power: 58
Reputation: 727
cam34 is a splendid one to beholdcam34 is a splendid one to beholdcam34 is a splendid one to beholdcam34 is a splendid one to beholdcam34 is a splendid one to beholdcam34 is a splendid one to beholdcam34 is a splendid one to behold
Default

Hey I have a question. If there a way to ghost a drive to another. This way works but requires twice as much space than neccesary. eg. it requires that you backup to a drive with enough space for the NTFS file then to restore it to another. How would I clone a drive in one step. eg have a harddrive in computer which is being upgraded to another drive with a larger size - how would i do it?

I was thinking of using a live cd to clone a laptop to another drive thats mounted via a portable USB2 Laptop HDD

Does this method copy the MBR also?


Thanks
__________________
Fedora 12 - 64bit - Nvidia 9600GT - AMD Quad Core Phenom - 1.5 Terrabytes Storage - 8GB DDR2 RAM
BOFH / SYSADMIN / Novell CLA and CLP
Reply With Quote
  #5  
Old 08-14-2007, 04:28 AM
cam34 cam34 is offline
MEPIS Guide
 
Join Date: Aug 2006
Location: En Zed
Posts: 309
Thanks: 22
Thanked 87 Times in 46 Posts
Rep Power: 58
Reputation: 727
cam34 is a splendid one to beholdcam34 is a splendid one to beholdcam34 is a splendid one to beholdcam34 is a splendid one to beholdcam34 is a splendid one to beholdcam34 is a splendid one to beholdcam34 is a splendid one to behold
Default

Just to answer my own question above ^^
If i wanted to directly copy one drive to another i could simply type
Code:
dd if=/dev/olddrive of=/dev/newdrive

EG.

dd if=/dev/hda of=/dev/sdb
That would copy multiple partitions etc (if setup) from the old drive to the new one. (Notice NO partition numbers)

Then copy MBR with:

Code:
dd if=/dev/olddrive of=/dev/newdrive bs=512 count=1
PS Drives have to be UNmounted for this to work
Hope this helps someone.
Reply With Quote
  #6  
Old 08-14-2007, 05:39 AM
Acesabe's Avatar
Acesabe Acesabe is offline
Super Moderator
 
Join Date: Jul 2006
Posts: 3,663
Thanks: 447
Thanked 1,065 Times in 657 Posts
Rep Power: 149
Reputation: 6360
Acesabe has a reputation beyond reputeAcesabe has a reputation beyond reputeAcesabe has a reputation beyond reputeAcesabe has a reputation beyond reputeAcesabe has a reputation beyond reputeAcesabe has a reputation beyond reputeAcesabe has a reputation beyond reputeAcesabe has a reputation beyond reputeAcesabe has a reputation beyond reputeAcesabe has a reputation beyond reputeAcesabe has a reputation beyond repute
Default

In my (limited) experience, imaging a whole drive e.g. /dev/hda will include the mbr, so when the image is copied to new drive, the mbr (and thus grub etc) will be included...
Reply With Quote
  #7  
Old 08-14-2007, 06:43 AM
m_pav's Avatar
m_pav m_pav is offline
MEPIS Guide
 
Join Date: Aug 2006
Location: New Zealand BOP
Gender: Male
Posts: 2,252
Thanks: 321
Thanked 1,111 Times in 674 Posts
Rep Power: 134
Reputation: 6328
m_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond repute
Default

Ko, you do not mention whether the drive or partitions intended for backing up or restoring have to be mounted or unmounted, so am I right to interpret this omission (possibly deliberate) as an indication that they should be mounted when using ntfsclone?

And secondly, does the ntfs-3g driver have any conflicts that you (or another mepislover) know about with ntfsprogs and ntfsclone when such an operation is running?

Mike P
Reply With Quote
  #8  
Old 08-14-2007, 06:48 AM
m_pav's Avatar
m_pav m_pav is offline
MEPIS Guide
 
Join Date: Aug 2006
Location: New Zealand BOP
Gender: Male
Posts: 2,252
Thanks: 321
Thanked 1,111 Times in 674 Posts
Rep Power: 134
Reputation: 6328
m_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond reputem_pav has a reputation beyond repute
Default Acesabe is correct

Quote:
Originally Posted by Acesabe View Post
In my (limited) experience, imaging a whole drive e.g. /dev/hda will include the mbr, so when the image is copied to new drive, the mbr (and thus grub etc) will be included...
I use dd without any partition numbers to copy data from damaged windows drives to a fresh hard disk when data recovery is required and the boot track does get copied as well as any partitions, warts and all.

Mike P
Reply With Quote
  #9  
Old 08-14-2007, 06:57 AM
ko's Avatar
ko ko is offline
Whatever
 
Join Date: Jul 2006
Location: Netherlands
Gender: Male
Posts: 5,369
Thanks: 538
Thanked 2,007 Times in 1,220 Posts
Rep Power: 222
Reputation: 11933
ko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond reputeko has a reputation beyond repute
Default

Quote:
Originally Posted by m_pav View Post
Ko, you do not mention whether the drive or partitions intended for backing up or restoring have to be mounted or unmounted, so am I right to interpret this omission (possibly deliberate) as an indication that they should be mounted when using ntfsclone?

And secondly, does the ntfs-3g driver have any conflicts that you (or another mepislover) know about with ntfsprogs and ntfsclone when such an operation is running?

Mike P
No, you don't need to mount. ntfsclone works at the disk sector level.

Quote:
Name
ntfsclone - Efficiently clone, image, restore or rescue an NTFS

Description
ntfsclone will efficiently clone (copy, save, backup, restore) or rescue an NTFS filesystem to a sparse file, image, device (partition) or standard output. It works at disk sector level and copies only the used data. Unused disk space becomes zero (cloning to sparse file), encoded with control codes (saving in special image format), left unchanged (cloning to a disk/partition) or filled with zeros (cloning to standard output).

ntfsclone can be useful to make backups, an exact snapshot of an NTFS filesystem and restore it later on, or for developers to test NTFS read/write functionality, troubleshoot/investigate users’ issues using the clone without the risk of destroying the original filesystem.

The clone, if not using the special image format, is an exact copy of the original NTFS filesystem from sector to sector thus it can be also mounted just like the original NTFS filesystem. For example if you clone to a file and the kernel has loopback device and NTFS support then the file can be mounted as

mount -t ntfs -o loop ntfsclone.img /mnt/ntfsclone
As to your second question: No, not to my knowledge.
Might be useful to check into the ntfsprogs links provided earlier.

Regards, Ko
Reply With Quote
  #10  
Old 10-14-2007, 12:06 AM
jozien jozien is offline
MEPIS Lover
 
Join Date: Aug 2006
Posts: 172
Thanks: 3
Thanked 3 Times in 3 Posts
Rep Power: 0
Reputation: 21
jozien is on a distinguished road
Default re: How to clone a NTFS partition from Mepis 6.5

[quote=ko;50503]Hi,


Regular:
If you want to make a backup called hda1.ntfs of the filesystem on the NTFS partition /dev/hda1 then do as follows:
Open a konsole and type:

ntfsclone -s -o hda1.ntfs /dev/hda1

How do you put the backup "hda1.ntfs" on a external USB drive /dev/sdb1 ?

Very good how-to.

jozien
Reply With Quote
Post New Thread  Reply

  MEPISlovers Forum > Help > Regulars


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 10:48 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2007-2010 MEPISlovers.org