Jump to content
  • 0

How to burn a Micro SD card from one that works perfect


fritserasmus

Question

10 answers to this question

Recommended Posts

  • 0

These two commands will do it on a unix (linux. OSX) machine:

dd if=/dev/mmcblk0 bs=1M of=/tmp/image
dd if=/tmp/image bs=1M of=/dev/mmcblk0

Of course there are some caveats. You have to swap the card in the middle. If the computer auto-mounts the card you will have to manually unmount it each time. And the new card needs to be at least as big as the old one, otherwise the end of the file system might be cut off.

The other option is to partition it manually and copy the files using the cpio command (to preserve all permissions, hard links and sparseness where applicable).

It's going to depend on what you have available to do the copy with. You should be able to use something like win32diskimager or windd to do the same thing as the unix commands... but if the new card is smaller (it happens, marketing decides to call it 32GB even though it is half a meg short) you're going to have an interesting time :-)

Link to comment
Share on other sites

  • 0
13 hours ago, plonkster said:

These two commands will do it on a unix (linux. OSX) machine:


dd if=/dev/mmcblk0 bs=1M of=/tmp/image
dd if=/tmp/image bs=1M of=/dev/mmcblk0

Of course there are some caveats. You have to swap the card in the middle. If the computer auto-mounts the card you will have to manually unmount it each time. And the new card needs to be at least as big as the old one, otherwise the end of the file system might be cut off.

The other option is to partition it manually and copy the files using the cpio command (to preserve all permissions, hard links and sparseness where applicable).

It's going to depend on what you have available to do the copy with. You should be able to use something like win32diskimager or windd to do the same thing as the unix commands... but if the new card is smaller (it happens, marketing decides to call it 32GB even though it is half a meg short) you're going to have an interesting time :-)

@plonksterI am lucky in the sense I am upgrading from 32 to 64Gb, but unlucky as I have to use windows.

Can I use Etcher and put both cards in the PC and just etcher copy/burn?

 

Link to comment
Share on other sites

  • 0
9 minutes ago, fritserasmus said:

@plonksterI am lucky in the sense I am upgrading from 32 to 64Gb, but unlucky as I have to use windows.

Can I use Etcher and put both cards in the PC and just etcher copy/burn?

 

I have no idea, but you probably can.

Just note: When you copy it in this manner, the filesystem will retain its original size. It will only use the first 32GB of the new larger card.

To use the whole thing, you need to resize the filesystem with resize2fs, once again easy enough on a linux machine:

fsck -f /dev/mmcblk0p2
resize2fs /dev/mmcblk0p2

The filesystem check is required, because resize2fs refuses to work on a filesystem that hasn't been checked first. You resize partition 2 (p2) because the first partition is a FAT partition that only holds the proprietary bootloader and the kernel and doesn't need to be made larger.

Unfortunately you cannot resize the partition you're booted from, so this cannot be done on the Pi. Might be able to do it on the Pi if you have a USB-sdcard reader, but then the device won't be mmcblk0 of course :-)

Link to comment
Share on other sites

  • 0
22 minutes ago, plonkster said:

I have no idea, but you probably can.

Just note: When you copy it in this manner, the filesystem will retain its original size. It will only use the first 32GB of the new larger card.

To use the whole thing, you need to resize the filesystem with resize2fs, once again easy enough on a linux machine:


fsck -f /dev/mmcblk0p2
resize2fs /dev/mmcblk0p2

The filesystem check is required, because resize2fs refuses to work on a filesystem that hasn't been checked first. You resize partition 2 (p2) because the first partition is a FAT partition that only holds the proprietary bootloader and the kernel and doesn't need to be made larger.

Unfortunately you cannot resize the partition you're booted from, so this cannot be done on the Pi. Might be able to do it on the Pi if you have a USB-sdcard reader, but then the device won't be mmcblk0 of course :-)

That was all the pointers I needed. I have a friend with Linux on his LAPTOP. why laptop because it already has a SD Card reader, I have a SD Adapter and a Micro SD USB card reader so I just MIGHT be in luck!!

I will let you guys know

Link to comment
Share on other sites

  • 0

Apologies, I forgot that you also need to enlarge the partition itself!

So you'd have to edit it in fdisk, print the current layout, then delete partition number 2 (don't worry, the data is still there). Then recreate it with the exact same start cylinder but accept the default offered as end cylinder (which should allocate all remaining space to partition 2).

Then fsck the filesystem and resize2fs it. Resize2fs will automatically use all the available space.

Yes, I know that the command to check a file system is dangerously close to another 4-letter word. In fact, it's a running joke inside the unix community. We have several of those, including also unzip, touch, yes, mount, and even sleep.

:-P

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...