LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-24-2015, 04:25 PM   #1
toolbox1234
LQ Newbie
 
Registered: Jan 2009
Posts: 27

Rep: Reputation: 0
How to duplicate a SD card with 2 partitions under Debian


For my cell phone, I used an app named link2sd with a SD card. Because the current 8GB card is filled up, I got a 32GB card to take its place. For the link2sd app, the SD card is partitioned into 2 partitions. First partition is formatted to fat32 and the 2nd one is ext2 format. What is the proper way to copy content of these partitions to the new card? Thanks in advance.
 
Old 04-24-2015, 05:15 PM   #2
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 934

Rep: Reputation: 104Reputation: 104
Hi
Let's try to reorganize the informations you gave - shouldn't matter what the source of your data is.

You've got a 8GB card which has 2 partitions:
- part #1: fat32
- part #2: ext2

You want to have those 2 partitions and their data on your brand new sdcard?


If it's like this then you fist copy everything from the old card....
Code:
dd if=/dev/<your_8gb_card> of=anyfilename.data
...and then you copy it back to your brand new card 32GB card...
Code:
dd if=anyfilename.data of=/dev/<your_32gb_card>
It will be different if you want to resize any of the 2 partitions.
 
Old 04-24-2015, 06:05 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
You have a choice of bit by bit and file by file. The above example is bit by bit. I assume it may work if cards are identical.

One can use other types of file by file copy too for mismatched drive.
 
Old 04-24-2015, 06:16 PM   #4
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 934

Rep: Reputation: 104Reputation: 104
Quote:
I assume it may work if cards are identical.
Will work as long as the target is bigger than the source.
Used this often when transferring partition-sets 1:1
 
Old 04-24-2015, 06:24 PM   #5
toolbox1234
LQ Newbie
 
Registered: Jan 2009
Posts: 27

Original Poster
Rep: Reputation: 0
Thanks. Yes, I need to resize the 2 partitions. On the 8GB card, I have it divided into 4 and 4. For the new one, I want something like 16 & 16.
 
Old 04-24-2015, 06:33 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,602

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
I would think using a "cp -ra src dest" would be the simplest - but it requires you to have both cards installed at the same time.

If you want to make a backup, then I would suggest using tar. Then you can unplug the source, and plug in the second and restore the tar file.
 
Old 04-24-2015, 06:39 PM   #7
toolbox1234
LQ Newbie
 
Registered: Jan 2009
Posts: 27

Original Poster
Rep: Reputation: 0
Can I tar the fat32 partition?
 
Old 04-24-2015, 09:19 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
It depends on the data. Most common users can use any number of file by file tools. tar is a way to move files and has an advantage in some ways. If you have programs that are tied to a very specific location then you may have trouble with any sort of copy.

I sometimes get lazy and use gparted.
 
Old 04-25-2015, 09:26 AM   #9
fatmac
Senior Member
 
Registered: Sep 2011
Location: Surrey/Hants Border, UK
Distribution: BSD & Linux - As long as they are Lightweight
Posts: 1,491

Rep: Reputation: Disabled
The utility tar just puts all files into a single archive (file), but if you use gzip you can compress the archive as well.
Then you just extract the archive (tar or tar.gz) onto your new disk.
(Create your partitioning scheme first.)
 
Old 04-25-2015, 09:45 AM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,602

Rep: Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241Reputation: 1241
tar has access to many different inline compression tools that can be used while creating the backup. Your choice.
 
Old 04-25-2015, 02:21 PM   #11
toolbox1234
LQ Newbie
 
Registered: Jan 2009
Posts: 27

Original Poster
Rep: Reputation: 0
Thanks. I will look up how to tar a Fat32 partition.
 
Old 04-25-2015, 05:59 PM   #12
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
Thanks for the update.

Just to be correct, you tar files not partitions but I assume you know that.
 
Old 04-26-2015, 12:08 AM   #13
toolbox1234
LQ Newbie
 
Registered: Jan 2009
Posts: 27

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jefro View Post
Thanks for the update.

Just to be correct, you tar files not partitions but I assume you know that.
Yes, I just have to make sure I am using the right switches to back up everything correctly. Thanks.
 
  


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
Can duplicate partitions be created on one hard drive to keep data safer? General Linux - General 7 02-26-2015 11:14 AM
155 duplicate swap partitions on eeepc1201! RohitBhosale Linux - Laptop and Netbook 9 10-11-2011 10:53 AM
duplicate CF card using dd doxJeremy *BSD 8 03-02-2009 12:30 PM
Debian menu items in duplicate farslayer Debian 2 01-10-2008 11:20 PM
Mounting duplicate Linux partitions rridler Linux - Newbie 9 05-03-2004 03:24 PM


All times are GMT -5. The time now is 10:06 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