0

I am currently running out of an 8GB SD Card, I need to copy the drive to a 16GB SD Card.

dd from my research clones the partitions and the boot sector, etc.

The 8GB drive is encrypted, how do I cater for this and the drive being cloned / copied is in use, how do I deal with that so that any copy is exact and is their a verify setting?.

So far, the disk util says:

Ext2 (version 1.0) — Mounted at /boot

The /boot contains /dev/sda1, /dev/sda2 and s/dev/da5 and another partition /dev/mapper/sda5_crypt

I want it cloned to the 16GB SD Card which will need to be formatted as its W95 type fat table, states its read only, not sure why that is as it is definitely writable as it was in my camera up to a week ago.

Currently I have the following command:

dd if=/dev/sda of=/dev/sda conv=noerror,sync

Am I right that this will copy the entire disk with the sda2 et al partitions over to the drive that a fresh sda will be created?

** EDIT **

PROBLEM SOLVED

Just to let you know, the HDD died today, its not even spinning and made a god awful squeal, rebooted to find I can't enter BIOS until the HDD has been detected, Nice one AMI, way to go with that kind of programming...

Hans
  • 1,281
  • 1
  • 20
  • 44

1 Answers1

1

Currently I have this command:-

dd if=/dev/sda of=/dev/sda conv=noerror,sync

Am I right that this will copy the entire disk with the sda2 et al partitions over to the drive that a fresh sda will be created?

Notice that you have a typo in your command. Output file should be the target drive, i.e. most likely sdb. Check which is the source drive and which is the target drive carefully before doing anything! If sda=source drive and sdb=target drive, the command would be:

dd if=/dev/sda of=/dev/sdb conv=noerror,sync

and, to answer your question, yes. But keep in mind that conv=noerror,sync will force bad blocks (if present) to be copied without any warning.

The 8GB drive is encrypted, how do I cater for this and the drive being cloned / copied is in use, how do I deal with that so that any copy is exact and is their a verify setting?

No problems in regard to the encryption, but absolutely don't clone the drive while it's in use. Boot from a live CD/DVD and do everything from there. Once done you can compare the drives using cmp; first of all you'll need to know the size of your first drive in byte. You can use fdisk to do this: in a terminal:

fdisk -l /dev/sda

Then:

cmp -n <size_of_sda_in_bytes> /dev/sda /dev/sdb

where <size_of_sda_in_bytes> is the size the first drive in byte. If there's no output, the drives match up to byte <size_of_sda_in_bytes>, i.e. the whole procedure succeded

kos
  • 35,891
  • Ok, so as long as I call my if & of drives after the devices are allocated a mount point under the LiveCD then all the /dev/sd* drives on the target /dev/sda are copied. I am confused by another site that stated that I would have to copy each partition separately. – Mark Giblin Feb 26 '15 at 18:10
  • @MarkGiblin Can you post the link? – kos Feb 26 '15 at 18:20
  • Can remember the site name, tried looking through the history folder but thats missing data, this FF browser crashes more times than a Windoze box, I have tried looking for it again and I can't remember where but do remember the comment regarding partitions and having to issue individual commands per partition. Anyway, I can't spend any more time on this subject, I really need to get this install sorted so I fix my PC. – Mark Giblin Feb 26 '15 at 22:29
  • @MarkGiblin Ok, i was just curious, anyway the command you have will clone the specified drive to the new one as you expect, you can go with it, but again, be careful expecially when specifying the source drive and the target drive, and follow the advices i gave you in the answer – kos Feb 26 '15 at 22:35
  • Having problems with copying, I get told that the action is not permitted. – Mark Giblin Feb 27 '15 at 12:26
  • @MarkGiblin If you're not root you need to use sudo:sudo dd if=/dev/sda of=/dev/sdb conv=noerror,sync – kos Feb 27 '15 at 12:44
  • Yep, I did root, issued the command and I got told that the action was not permitted. So whilst on LiveUSB, I tried to make a post on here but firefox crashed and that caused an issue somewhere because I ended up holding the power button to shut lappy down. I am going to have a think about a work around, might try and get my camera to format the card then format it under Ubuntu the try again. – Mark Giblin Feb 27 '15 at 12:56
  • Make sure that both drives have no partition mounted, otherwise you can't (and shouldn't) do that, if they have umount them, then from a user shell: sudo dd if=/dev/sda of=/dev/sdb conv=noerror,syn – kos Feb 27 '15 at 13:03