LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to duplicate a SD card with 2 partitions under Debian (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-duplicate-a-sd-card-with-2-partitions-under-debian-4175540657/)

toolbox1234 04-24-2015 03:25 PM

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.

Pearlseattle 04-24-2015 04:15 PM

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.

jefro 04-24-2015 05:05 PM

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.

Pearlseattle 04-24-2015 05:16 PM

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 :)

toolbox1234 04-24-2015 05:24 PM

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.

jpollard 04-24-2015 05:33 PM

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.

toolbox1234 04-24-2015 05:39 PM

Can I tar the fat32 partition?

jefro 04-24-2015 08:19 PM

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.

fatmac 04-25-2015 08:26 AM

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.)

jpollard 04-25-2015 08:45 AM

tar has access to many different inline compression tools that can be used while creating the backup. Your choice.

toolbox1234 04-25-2015 01:21 PM

Thanks. I will look up how to tar a Fat32 partition.

jefro 04-25-2015 04:59 PM

Thanks for the update.

Just to be correct, you tar files not partitions but I assume you know that. :)

toolbox1234 04-25-2015 11:08 PM

Quote:

Originally Posted by jefro (Post 5353068)
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.


All times are GMT -5. The time now is 12:17 PM.