freeman
Posts: 50
Joined: Wed Sep 18, 2013 7:57 am
Location: European Union
Contact: Website

Resize 16GB SD -> 8GB

Mon Oct 21, 2013 9:08 am

I have working debian on 16GB SD, how to transfer it to 8GB SD. Simple DD image not works. How to do it?
-----
Tomas Freeman

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Resize 16GB SD -> 8GB

Mon Oct 21, 2013 10:39 am

freeman wrote:I have working debian on 16GB SD, how to transfer it to 8GB SD. Simple DD image not works. How to do it?
There are probably "magic incantation" ways of doing it, that no doubt others will post about, but I think the most straightforward way is just to copy the files.

That is (roughly, you'll have to fill in the exact command line details):
  1. Use "fdisk" to partition the new card into two partitions.

    Format the first one FAT and the second one ext4

    Mount them both - as /mnt/newboot and /mnt/newrootfs

    cp -av /boot/* /mnt/newboot

    cp -av / /mnt/newrootfs
Note that the last command above isn't really right - although I think it will actually work OK in most simple setups - it is not optimal (as others will no doubt point out for my benefit...). In fact, there are a couple of optimizations you might employ:
  1. Best is to do this on another Linux machine (not on the Pi itself), in which case, it is much easier since you'll be copying from /mnt/whereverThePiSDCardIsMounted instead of from /

    Or you can figure out how to use "find" so as not to copy stuff you shouldn't be copying (instead of a blanket "cp -av").
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

andrea1985
Posts: 33
Joined: Sun Jun 15, 2014 5:53 pm

Re: Resize 16GB SD -> 8GB

Fri May 22, 2015 1:16 pm

Hello, I use:
sudo cp -av /mnt/* /media/7582-6510/

but his method for me doesn't work, the shell give to me the results belo

`/mnt/start_x.elf' -> `/media/7582-6510/start_x.elf'
cp: failed to preserve ownership for `/media/7582-6510/start_x.elf': Operation not permitted

andrea1985
Posts: 33
Joined: Sun Jun 15, 2014 5:53 pm

Re: Resize 16GB SD -> 8GB

Fri May 22, 2015 2:40 pm

despect this errors all works like a charm...
Why I have this error in the cp command?

User avatar
DougieLawson
Posts: 36098
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Resize 16GB SD -> 8GB

Fri May 22, 2015 3:16 pm

andrea1985 wrote:despect this errors all works like a charm...
Why I have this error in the cp command?
It's because the target filesystem is FAT/vFAT/exFAT and doesn't support the Linux/Unix security model. You can safely ignore the warning messages.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Troubleshooting”