LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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, 03:25 PM   #1
toolbox1234
Member
 
Registered: Jan 2009
Posts: 32

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, 04:15 PM   #2
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
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, 05:05 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,982

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
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, 05:16 PM   #4
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
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, 05:24 PM   #5
toolbox1234
Member
 
Registered: Jan 2009
Posts: 32

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, 05:33 PM   #6
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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, 05:39 PM   #7
toolbox1234
Member
 
Registered: Jan 2009
Posts: 32

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

Rep: Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626Reputation: 3626
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, 08:26 AM   #9
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,493

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, 08:45 AM   #10
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

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

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

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

Just to be correct, you tar files not partitions but I assume you know that.
 
Old 04-25-2015, 11:08 PM   #13
toolbox1234
Member
 
Registered: Jan 2009
Posts: 32

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



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 10:14 AM
155 duplicate swap partitions on eeepc1201! RohitBhosale Linux - Laptop and Netbook 9 10-11-2011 09:53 AM
duplicate CF card using dd doxJeremy *BSD 8 03-02-2009 11:30 AM
Debian menu items in duplicate farslayer Debian 2 01-10-2008 10:20 PM
Mounting duplicate Linux partitions rridler Linux - Newbie 9 05-03-2004 02:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:27 AM.

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
Open Source Consulting | Domain Registration