Page 1 of 1

Resize 16GB SD -> 8GB

Posted: Mon Oct 21, 2013 9:08 am
by freeman
I have working debian on 16GB SD, how to transfer it to 8GB SD. Simple DD image not works. How to do it?

Re: Resize 16GB SD -> 8GB

Posted: Mon Oct 21, 2013 10:39 am
by Joe Schmoe
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").

Re: Resize 16GB SD -> 8GB

Posted: Fri May 22, 2015 1:16 pm
by andrea1985
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

Re: Resize 16GB SD -> 8GB

Posted: Fri May 22, 2015 2:40 pm
by andrea1985
despect this errors all works like a charm...
Why I have this error in the cp command?

Re: Resize 16GB SD -> 8GB

Posted: Fri May 22, 2015 3:16 pm
by DougieLawson
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.