[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How do I clone a Debian Distro from a 32Gb Class 10 MicroSD card to a 16Gb Class 10 A1 MicroSD card?



Hello Andei.  As requested.  What I've got running Armbian Linux on is . . .
https://linux-sunxi.org/LeMaker_Banana_Pro

root@loki:~# fdisk -l
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/mmcblk0: 29.74 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe069b87e

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       8192 61702143 61693952 29.4G 83 Linux


Disk /dev/zram0: 483.64 MiB, 507117568 bytes, 123808 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/zram1: 50 MiB, 52428800 bytes, 12800 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
root@loki:~# lsblk -f
NAME        FSTYPE LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINT
mmcblk0
└─mmcblk0p1 ext4         dffd2ee5-5480-480b-9853-7884f8ba5e47     23G    18% /
zram0                                                                        [SWAP]
zram1                                                           21.7M    48% /var/log
root@loki:~#


On Sun, 19 Sept 2021 at 05:58, Andrei POPESCU <andreimpopescu@gmail.com> wrote:
On Sb, 18 sep 21, 12:35:13, Myron wrote:
> Never done this one with Linux before.  I know that there is less than 16Gb
> of data written to the Class 10 32Gb MicroSD card which is used as the
> primary system storage on a single board system-on-a-chip computer.  What
> I'm after is getting a 16 Gb Class 10 A1 MicroSD card and clone the entire
> system from the 32Gb card to the 16Gb card.
>
> What I'm after is when I start the SOC computer from the replacement 16Gv
> Class 10 A1 MicroSD card, it will just start like there have been no
> changes, well, apart from there being 16Gb storage and not slower 32Gb
> storage.
>
> This is relatively easy to do on Windows.  No clue how to do this with
> Linux.

Do you have another Linux (capable) system to work with? In this case
try GParted, possibly from a live Linux if all your other systems are
Windows:

https://cdimage.debian.org/images/unofficial/non-free/images-including-firmware/11.0.0-live+nonfree/amd64/iso-hybrid/

If all you have to work with is the Linux system itself you need to do
an "online resize" of the filesystem(s) and then adjust the partition
table to match[1].

Before starting the operation make sure you are shrinking to the correct
size, because many SD cards are slightly smaller than advertised. If in
doubt shrink more, copy and then grow (online grow is mostly the same as
shrink -- in reverse order -- and will be much faster as there is no
data to move around).

Please post the full output of:

    fdisk -l
    lsblk -f

    (use sudo or root as needed)

with both SD cards plugged in case you need assistance with the manual
method.

[1] yes, the partition and the filesystem within it can be adjusted
independently, even for NTFS. The graphical tools (GParted included)
just show this to be one operation.

Hope this helps,
Andrei
--
http://wiki.debian.org/FAQsFromDebianUser

Reply to: