1

I need to duplicate SD for RPI, but if I use 32G SD than it might not fit on other 32G SD, so I'm forced to use 16G SD, but than I loose half of the SD size.

I followed the instruction in How can I resize my / (root) partition?

I was able to resize the partition to the full disk size but when I do

sudo resize2fs /dev/mmcblk0p3

I get:

resize2fs 1.43.3 (04-Sep-2016)
resize2fs: Device or resource busy while trying to open /dev/mmcblk0p3
Couldn't find valid filesystem superblock.

I wasn't able to continue from there, or to find any info about this issue.

I'm confused about how is it possible to change a fs while you are using it, I guess the answer is that you cannot, but the answer in How can I resize my / (root) partition? claim it should work.

The other thing I don't understand is how could it be so difficult to find info about resizing an img to fit the SD? it seems like a very basic actioned, as in my case for example.

This is the result of sudo fdisk /dev/mmcblk0 (before extending the partition):

Disk /dev/mmcblk0: 14.9 GiB, 15931539456 bytes, 31116288 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: 0x00013bb5

Device         Boot   Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *          1   125000   125000   61M  c W95 FAT32 (LBA)
/dev/mmcblk0p2       125001  4882812  4757812  2.3G 83 Linux
/dev/mmcblk0p3      4884480 31116287 26231808 12.5G 83 Linux

This is the result of df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p2  2.2G  592M  1.5G  29% /imgpart
/dev/loop0      260M  260M     0 100% /static
overlay          13G  3.3G  8.3G  29% /
devtmpfs        475M     0  475M   0% /dev
tmpfs           486M     0  486M   0% /dev/shm
tmpfs           486M  8.6M  477M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           486M     0  486M   0% /sys/fs/cgroup
tmpfs           486M   32K  486M   1% /tmp
tmpfs           486M     0  486M   0% /var/spool/cups
tmpfs            20M  524K   20M   3% /var/log
tmpfs           486M     0  486M   0% /var/spool/cups/tmp
/dev/mmcblk0p1   61M   35M   26M  58% /boot
tmpfs            98M     0   98M   0% /run/user/1000

NOTE: I'm running Volumio, and the / is mounted to partition 3 (I'm not sure why it show up as overlay)

  • if btrfs try this cmd btrfs filesystem resize max /home/data – guest Sep 22 '18 at 11:58
1

There are two problems with your attempt. You try to expand

rpi3 ~$ sudo resize2fs /dev/mmcblk0p3

This is partition 3 on your SD Card. A default up to date Raspbian image only has two partitions:

/dev/mmcblk0p1   vfat32   boot partition
/dev/mmcblk0p2   ext4     root partition

There is no swap partition anymore. You should double check your partition numbers.

The accepted answer in How can I resize my / (root) partition? advises you to recreate the root partition. This was OK in 2012 but since that time it has changed something in addressing partitions in /boot/cmdline.txt and in /etc/fstab. If you use a disk partitioner like fdisk or parted it is possible that PARTUUID has changed and your SD Card will not boot. Maybe you have to edit /boot/cmdline.txt and /etc/fstab and change the partition names to /dev/mmcblk0p1 and /dev/mmcblk0p2. Further information about this issue you can find at Is it possible to use partition UUID for root-parameter in cmdline.txt?.

  • I running Volumio, and the / is mounted to 3 – Elia Weiss Apr 10 '18 at 17:41
  • 1
    @EliaWeiss There is no info about this important detail on your question. Can you then please add an appropriate flag? – Ingo Apr 10 '18 at 18:06
0

in answer to your second question:

You can use piclone to copy an (expanded or not-expanded) filesystem on a 32GB sd card onto another 32GB sd card. just install it with

sudo apt-get install piclone

then run it by typing piclone.(you have to have a GUI(desktop) running.)

Hope this answers your second question, I'm not positive this was the answer your looking for...

0

@guest's suggestion above worked for me. I'm running Xbian (which uses btrfs) and needed to modify the command for xbian's file structure. Here's what I used:

sudo btrfs filesystem resize max /home/xbian

Worked like a charm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.