LinuxQuestions.org
Visit Jeremy's Blog.
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 02-21-2015, 12:37 AM   #1
RoyLittle0
LQ Newbie
 
Registered: Feb 2015
Distribution: Kali, Mint
Posts: 6

Rep: Reputation: Disabled
Clone a bootable CF card with multiple partitions and copy to bigger drive


Hi, all, I am new to the forum and quite new to Linux, I am running Mint and Kali from a USB drive, all is going well with with the software and I am starting to find my way around it.

So, now to my question, I have 15 machines which all run from a CF card and the card has multiple partitions and is a Windows Embedded XP, not that the operating system makes any difference, I need to upgrade all the CF cards from 2gb to 4gb, so unfortunately Windows isn't an option to use to copy the drives as it doesn't recognise multiple partitions on a removable drive, so I cant just remove the drive, clone it and fit the new one.

What I need is a method of cloning the drive completely with both partitions, I have read about dd but cant seem to see anything about doing this with multiple partitions, as Linux sees it as two drives when I plug it in, how can I use dd or anything else to clone the drive which is bootable and has two partitions?

At some point I would like to automate the process as I could have many of these machines/drives to upgrade, is there a way to write a program that will automatically back up the drives from a USB drive and then reinstall it, I have seen this done before but I am not sure if this method did the whole drive, just the main drive or all partitions?
 
Old 02-21-2015, 05:29 AM   #2
fatmac
Senior Member
 
Registered: Sep 2011
Location: Surrey/Hants Border, UK
Distribution: BSD & Linux - As long as they are Lightweight
Posts: 1,704

Rep: Reputation: Disabled
I use dd when cloning, simply because I'm used to it. Use the whole drive designations, not the partition designations.

Example:
Code:
dd if=/dev/sda of=/dev/sdb bs=1M
To create an image to put onto lots of other disks:
Code:
dd if=/dev/sda of=mydisk.img bs=1M
Then use:
Code:
dd if=mydisk.img of=/dev/sdb bs=1M
to put it onto another machine.
 
1 members found this post helpful.
Old 02-21-2015, 06:55 AM   #3
RoyLittle0
LQ Newbie
 
Registered: Feb 2015
Distribution: Kali, Mint
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks for the reply

I like the look of the "mydisk.img" I just have one quick question before I give this a try, how do I determine what my drive is a b or c as they are shown as partitions when I view them in Computer?

OK I have found it, if I type lsblk, this shows me all the disks and partitions

Can I direct the image file to a location, or where will it be stored so that I can save it as a backup

The problem I am getting is there is not enough space on the Root to store the 4gb file, the space seems to be limited to 2gb on my root, I am running linux from a 32gb USB drive?

Last edited by RoyLittle0; 02-21-2015 at 07:51 AM.
 
Old 02-21-2015, 07:58 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,049

Rep: Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915
Quote:
Originally Posted by RoyLittle0 View Post
Can I direct the image file to a location, or where will it be stored so that I can save it as a backup

I have just tried it and it only copies one partition, i'll try again and see how I get on this time.
That might imply you are copying the img file to a [v]fat partition - it has a 2G file limit. Better to copy to a Linux filesystem.

Be aware that the restored CFcard will also be limited to 2 Gig (even if physically 4G) due to the fact that it is an image. Is the first partition the XP system, and the second partition data ?. Presumably you want to make the second bigger ?.
 
Old 02-21-2015, 08:36 AM   #5
RoyLittle0
LQ Newbie
 
Registered: Feb 2015
Distribution: Kali, Mint
Posts: 6

Original Poster
Rep: Reputation: Disabled
All I can tell you is that I currently have a 2gb CF card and I need to increase this to 4GB as I don't have any space on the card to add additional software, the 2 partitions are C:/Windows Embedded XP and D:/Data, the C drive is protected and the D is not, the D is used to user defined information

We already have 4gb cards in use on some of the machines but I need to upgrade them all

I am using Linux Kali from a bootable USB drive which has 4.66gb of space on it but the image always stops at 2gb, what are my options to create a image from a 4gb CF card and duplicate it

I do have a Linux virtual machine but I assume that will create further problems with shared drives

Last edited by RoyLittle0; 02-21-2015 at 08:38 AM.
 
Old 02-21-2015, 08:51 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,049

Rep: Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915
Let's see the output from the lsblk with the CF card attached to Kali. Also output from
Code:
df -hT
 
1 members found this post helpful.
Old 02-21-2015, 09:12 AM   #7
RoyLittle0
LQ Newbie
 
Registered: Feb 2015
Distribution: Kali, Mint
Posts: 6

Original Poster
Rep: Reputation: Disabled
This is a screen shot of the drives

I think I understand now, my USB boot drive is formatted to FAT32, i'll try again with a new drive and make it NTFS

Edit,
I have created a NTFS USB drive and had the results as with the FAT32 drive
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2015-02-21 14_02_52.png
Views:	110
Size:	86.5 KB
ID:	17626   Click image for larger version

Name:	Screenshot from 2015-02-21 14_20_41.png
Views:	65
Size:	82.9 KB
ID:	17628  

Last edited by RoyLittle0; 02-21-2015 at 11:22 AM.
 
Old 02-21-2015, 03:34 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,677

Rep: Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260Reputation: 2260
The embedded xp may not clone easily. Microsoft has full documentation on how to manage PE and embedded systems.

Generally I use G4U to clone but only because I'm too lazy.

Format has nothing to do with cloning. The command dd will destroy all data on the drive. (or original if you are not careful)

Linux and xp may have many files that have unique parameters that may need to be edited either before or after.

Xp can't legally be cloned with out licenses.

Some OS's know the type of geometry and won't easily clone.
 
Old 02-21-2015, 11:13 PM   #9
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,051

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
i think part of the problem is using microsoft filesystems on a linux system.

you may have better luck using gparted live-usb to copy partitions around.
 
Old 02-22-2015, 01:08 AM   #10
RoyLittle0
LQ Newbie
 
Registered: Feb 2015
Distribution: Kali, Mint
Posts: 6

Original Poster
Rep: Reputation: Disabled
Windows does not recognise a CF card that has multiple partitions, which I why I am not using Windows
Quote:
The embedded xp may not clone easily. Microsoft has full documentation on how to manage PE and embedded systems.

I was talking about the USB drive that contains the Linux operating system, which will be the destination of the files once copied, not the CF card
Quote:
Format has nothing to do with cloning. The command dd will destroy all data on the drive. (or original if you are not careful)

Our head office in Japan use Linux to make the disks to ship to us
Quote:
Linux and xp may have many files that have unique parameters that may need to be edited either before or after.

All machines are fully licence, as the original messages says, I am upgrading the card from 2gb to 4gb, which is perfectly acceptable
Quote:
Xp can't legally be cloned with out licenses.

As I have said this has been done before, I am also able to clone a single partition without issues
Quote:
Some OS's know the type of geometry and won't easily clone.
 
Old 02-22-2015, 03:27 AM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,049

Rep: Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915Reputation: 1915
Quote:
Originally Posted by RoyLittle0 View Post
I have created a NTFS USB drive and had the results as with the FAT32 drive
The source drive is irrelevant - the target (where the mydisk.img is being written to) cannot be vfat.

Looking at the attachment, it appears you want to enlarge the first partition - could be tricky as @jefro says. Or not - been too long since I messed with XP, and never embedded. Normally simply enlarging a partition/filesystem is pretty straight-forward, but you can't do that until the second partition is moved out of the way. And you certainly can't do it merely by cloning to a larger disk.
 
Old 02-22-2015, 05:18 AM   #12
fatmac
Senior Member
 
Registered: Sep 2011
Location: Surrey/Hants Border, UK
Distribution: BSD & Linux - As long as they are Lightweight
Posts: 1,704

Rep: Reputation: Disabled
Once you have a copy (mydisk.img) & have dd'ed it onto the larger disk, you should be able to boot it & use the extra space by creating a new partition with the original partitioner, then put a filesystem on it. Then make an image copy of this new disk to copy to all other needed disks.
 
Old 02-22-2015, 08:43 AM   #13
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,051

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
this is how I perform dd image copies and restores:
http://www.linuxquestions.org/questi...5/#post5308285

edit: im still confused. you have a 2 gb ms-xp disk and you want to clone it to a 4 gb disk (utilizing the full size) ?

I would boot up a live-usb with gparted on it. plug in both drives and perform the copy and expand (gparted is essentially a gui wrapper for dd and resize2fs).

Last edited by schneidz; 02-22-2015 at 08:55 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Image a bootable CF card with multiple partitions RoyLittle0 Linux - Newbie 1 02-21-2015 11:03 PM
[SOLVED] If I clone Ubuntu to a bigger hard drive / different dimensions, will it 'just work'? ziphem Linux - Newbie 8 08-25-2011 12:09 PM
[SOLVED] Clone Slackware onto Bigger Drive vttay03 Slackware 4 02-15-2010 08:02 PM
Bigger Hard Drive - Clone? Snump Mandriva 14 11-21-2006 09:37 AM
Can't copy a file bigger than 4GB's between partitions GoBillsBN Linux - Software 6 10-31-2005 03:55 AM


All times are GMT -5. The time now is 04:16 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration