FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Cannot resize Raspbian Stretch lite images with Parted

Sun Sep 10, 2017 1:09 am

Hello,

I spent a good few hours today setting up the Sept 2017 version of Raspbian Stretch lite on my Pi. I was working with a 16GB SD Card and I wanted to resize the partition to be smaller before making a backup in case I needed to restore the backup to a smaller SD card. So I went to resize the Raspbian installation on the SD card using GParted (on an Ubuntu machine) and now the SD card won't boot up in the Pi !!

Apparently Raspbian images since April 2017 don't work well with Parted...
https://raspberrypi.stackexchange.com/q ... -partition

Has anyone else had this problem? Apparently fdisk doesn't mess up the partition like Parted (GParted) does but I've read through these links...

How to Shrink an ext2/3/4 File system with resize2fs --> https://access.redhat.com/articles/1196333
How to Resize a Partition using fdisk --> https://access.redhat.com/articles/1190213
How to Grow an ext2/3/4 File System with resize2fs --> https://access.redhat.com/articles/1196353

... and using fdisk is a whole load of tedious command entering I don't need.

Does anyone know why these newer Raspbian images don't play ball with Parted? Is the Raspbian OS going to be updated so it does? I doubt Parted will be updated to work with Raspbian.

Thanks,

Flex

Martin Frezman
Posts: 953
Joined: Mon Oct 31, 2016 10:05 am

Re: Cannot resize Raspbian Stretch lite images with Parted

Sun Sep 10, 2017 1:29 am

I read through the article at the first URL you posted and it seems pretty clear what is going on. Was it unclear to you?

It says that the problem is that parted (and, therefore also gparted) changes the PARTUUID (Whatever that is) on the disk (SD card) and that causes current (unmodified) versions of Raspbian to fail to boot. This is because (since April 2017, this is why this date shows up in the article repeatedly) current versions of Raspbian use PARTUUID instead of the old /dev/mmbclk0p2 stuff to locate the rootfs. This all seems clear enough to me.

TBH, this sounds like another incarnation of the "predictable names" thing for ethernet devices; an attempt to fix something that wasn't broken.

In any case, if I were doing this, I'd just change the references (in cmdline.txt and /etc/fstab) back to mmcblk0p2 and be done.
If this post appears in the wrong forums category, my apologies.

User avatar
fruitoftheloom
Posts: 14536
Joined: Tue Mar 25, 2014 12:40 pm
Location: Bognor Regis UK

Re: Cannot resize Raspbian Stretch lite images with Parted

Sun Sep 10, 2017 4:53 am

The easiest way is to back up to another SD Card in a USB SDHC Card Reader.

Raspbian includes SD Card Copier for this purpose and automatically resizes the partitions.
My only "PC" is an Asus ChromeBit running ChromeOS, cloudcentric at its best !
Rockchip Quad-Core RK3288C SoC as used in ASUS Chromebook C201 & Chromebook Flip C100PA as well as the Tinker SBC

FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Sun Sep 10, 2017 10:16 am

Thank you for these responses. My knowledge of Unix like OS is quite basic.

Martin.. can you help me make the necessary changes to commandline.txt and /etc/fstab ??

// This is my commandline.txt file from the fat32 partition of the SD Card

Code: Select all

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=0e75fcd5-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
// This is the /etc/fstab from the EXT partition

Code: Select all

proc            /proc           proc    defaults          0       0
PARTUUID=0e75fcd5-01  /boot           vfat    defaults          0       2
PARTUUID=0e75fcd5-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
What references need to be changed and where did mmcblk0p2 come from?

FruitofTheLoom... I had never heard of SD Card Copier. I might start making backups that way because it sounds like less hassle. But I like the idea of resizing the SD card partition to be just a bit bigger than the max size of the filesystem so backups are smaller.

Cheers,

Flex

Martin Frezman
Posts: 953
Joined: Mon Oct 31, 2016 10:05 am

Re: Cannot resize Raspbian Stretch lite images with Parted

Sun Sep 10, 2017 10:54 am

Martin.. can you help me make the necessary changes to commandline.txt and /etc/fstab ??
Note 1: I'm assuming from your question that you're new enough to the Pi that you were not exposed to the old way - that is, the pre-April 2017 way.

Note 2: The below assumes Raspbian, and a "raw" (non-NOOBS) install.

In both files, wherever there is a reference to PARTUUID=something, you replace it with:

/dev/mmcblk0pX

where X is (usually) either 1 or 2.

So, in cmdline.txt, you would change root=PARTUUID=something to root=/dev/mmcblk0p2

In /etc/fstab, you do a similar change, where the thing that is mounted as "/" gets changed from PARTUUID=something to /dev/mmcblk0p2 (the same as in cmdline.txt) and the one that gets mounted as "/boot" gets changed from PARTUUID=something to /dev/mmcblk0p1.

If you do all this, then you will no longer be affected by rogue programs (like parted) changing PARTUUIDs behind your back.

BTW, you might want to search for and read a post I did a while back about Rescuing NOOBS - where a lot of this same ground is covered.
If this post appears in the wrong forums category, my apologies.

FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Sun Sep 10, 2017 7:00 pm

Hello!

I made those changes but it's still not booting. I tried what Martin suggested

==== I made my cmdline.txt look like this but it still didn't boot...

Code: Select all

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
==== I made a change to my /etc/fstab to look like this but no joy...

Code: Select all

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
I also tried the advice from TheDiveO from 7th June 2017 on this website: https://raspberrypi.stackexchange.com/q ... -partition but maybe I'm reading that advice the wrong way? I did a sudo blkid in Ubuntu and got this output..

Code: Select all

/dev/sdb1: LABEL="boot" UUID="B60A-B262" TYPE="vfat" 
/dev/sdb2: UUID="9a7608bd-5bff-4dfc-ac1d-63a956744162" TYPE="ext4"
==== Then I made cmdline.txt like this but it didn't boot either...

Code: Select all

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=9a7608bd-5bff-4dfc-ac1d-63a956744162 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
==== I also made /etc/fstab like this but no joy either...

Code: Select all

proc            /proc           proc    defaults          0       0
PARTUUID=B60A-B262  /boot           vfat    defaults          0       2
PARTUUID=9a7608bd-5bff-4dfc-ac1d-63a956744162  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
I wonder am I making a basic mistake or do I have no choice but to build the image from scratch again?

Thank you for any help, much appreciated,

Flex

Milliways
Posts: 212
Joined: Fri Apr 25, 2014 12:18 am

Re: Cannot resize Raspbian Stretch lite images with Parted

Mon Sep 11, 2017 11:16 am

I think the original premise of shrinking the partition is flawed, but regardless you want to fix it, and are mixing a number of different ideas.

There are several different ways of referencing partitions. Raspbian uses /dev, PARTUUID and UUID

On a working Raspbian (at least the recent releases) you can display the settings using the commands below

Code: Select all

sudo sfdisk --dump /dev/mmcblk0
label: dos
label-id: 0x6d9a0006
device: /dev/mmcblk0
unit: sectors

/dev/mmcblk0p1 : start=        8192, size=       85623, type=c
/dev/mmcblk0p2 : start=       94208, size=    30224384, type=83

Code: Select all

cat /etc/fstab
proc            /proc           proc    defaults          0       0
PARTUUID=6d9a0006-01  /boot           vfat    defaults          0       2
PARTUUID=6d9a0006-02  /               ext4    defaults,noatime  0       1
The label-id: identifies the disk, and has -0n appended to it to identify partitions. This is what is used in current Raspbian by default, but you can continue to use the /dev (as used in older Raspbian images)

Code: Select all

cat /etc/fstab
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1

Code: Select all

cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

cat /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=6d9a0006-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Which ever method you use needs to match cmdline.txt and /etc/fstab

There is a script which can be used to change PARTUUID if desired, but the one I use only works if the system is already consistent.

NOTE I mentioned UUID, which can be used to uniquely identify partitions, this is often used in /etc/fstab, but NOT (AFAIK) in cmdline.txt

FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Mon Sep 11, 2017 8:11 pm

Hello Milliways,

Thanks for your detailed response that explained things a bit more but I think what I tried was what you were suggesting...

// This is what cmdline.txt looked like after the partition resize using GParted

Code: Select all

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=0e75fcd5-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
// This is what /etc/fstab looked like after the partition resize using GParted

Code: Select all

proc            /proc           proc    defaults          0       0
PARTUUID=0e75fcd5-01  /boot           vfat    defaults          0       2
PARTUUID=0e75fcd5-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
It seems Raspbian doesn't understand those PARTUUID references anymore and so partitions modified with Parted/GParted render Raspbian images not bootable. The PARTUUID reference isn't the problem but its value. At least that's my understanding.

So with these two files on the SD card it was not booting. I'm assuming the problem is because of these two files due to the forum thread here https://raspberrypi.stackexchange.com/q ... -partition in particular the post at the end from "TheDiveO" who seems to know what he's talking about!

Anyway, here is what I tried...

// I changed cmdline.txt to this on the advice of Martin, previous poster in this thread. Basically just the root parameter which is what you were talking about...

Code: Select all

dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
// I also changed /etc/fstab to this.. again just took out the PARTUUID references replacing them with /dev partition references to be consistent with cmdline.txt...

Code: Select all

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
/dev/sda1       /media/usb1     vfat    uid=1000,gid=1000,utf8,dmask=027,fmask=137 0 0
# a swapfile is not a swap partition, so no using swapon|off from here on, use  dphys-swapfile swap[on|off]  for that
Milliways... from reading your post it sounds like this is what you are suggesting I try. But I already tried this... I went back to the /dev way of referencing the partitions in BOTH cmdline.txt AND/etc/fstab because it seems that Raspbian doesn't recognise anymore whatever change GParted/Parted makes to partition references. I then rebooted the SD card with these changes to these two files but it didn't boot.

I also made changes to cmdline.txt and /etc/fstab following advice from "TheDiveO" in https://raspberrypi.stackexchange.com/q ... -partition as detailed in my post above. Maybe I'm understanding him wrong but it sounds like you have to use PARTUUID to reference the partition in both files but the actual ID value has to come from the output of sudo blkid. I tried that too and it didn't work either.

It's also possible the SD card is corrupt or something else broke. I'm going to try building my image from scratch again on another SD card. I'm one of those types that can't go on with what I had intended until this thing is fixed and I understand why! By the way I don't want to use SD Card copier because it only works from the Raspbian GUI and I only work with Raspbian headless.

Any ideas what I might be doing wrong?

Flex

feelslikeautumn
Posts: 73
Joined: Wed Aug 09, 2017 9:51 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Mon Sep 11, 2017 10:20 pm

When it boots, how far does it get? What is the error message?

FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Mon Sep 11, 2017 10:34 pm

Hello,

I don't see any error messages. I am working with Raspbian Stretch Lite with no monitor... it's connected to my router with a LAN cable so I connect to it by Wifi via the router. I just power up the Pi and SSH in from Putty. All the lights come on the Pi including the big red one and they all stay on.

I gave the image a fixed ip address. When I go to my router it doesn't show up as a connected device and of course I don't get the log-in prompt in Putty terminal it just hangs. So this is my way of assuming that it is not actually booted up because before I resized this same image with GParted it was recognised by the router and I was able to SSH to it. I didn't make any changes to the start of the partition either. I just used GParted in Ubuntu to reduce the size of the partition/filesystem. I have done this many times in the past with no problems.

I wonder if I can rescue this image by making changes to the cmdline.txt and/etc/fstab files. Maybe what I have tried above is wrong in some way.

Cheers,

Flex

RonR
Posts: 78
Joined: Tue Apr 12, 2016 10:29 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Tue Sep 12, 2017 1:04 am

Attached is a script (set-boot) to set the partition table uuid, /boot/cmdline.txt, and /etc/fstab.

Usage:

set-boot device <ptuuid | /dev/mmcblk0>

The first parameter (device) may be /dev/sda through /dev/sdz, or /dev/mmcblk0

The second parameter may be 8 hex digits (ptuuid) or /dev/mmcblk0
If ptuuid is specified, the partition table uuid is set. /boot/cmdline.txt and /etc/fstab are set to match using PARTUUID notation.
If /dev/mmcblk0 is specified, the partition table uuid is not altered. /boot/cmdline.txt and /etc/fstab are set using /dev/mmcblk0 notation.

WARNING: Do not run this script on the only copy of an SD card in case there's an unforeseen bug present!
Attachments
set-boot.zip
(812 Bytes) Downloaded 14 times

FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Tue Sep 12, 2017 8:17 am

Cheers RonR,

Can you give me an example usage of this program as applied to my above case? Say I wanted to switch everything to the /dev referencing would it be like this...

Code: Select all

set-boot /dev/mmcblk0 /dev/mmcblk0
Does this set both boot and root partitions on the SD card or do I need to run the program twice? I understood that I needed to use /dev/mmcblk0p1 for /boot and /dev/mmcblk0p2 for / (root)

Another basic question... how do I install it?! Do I mount the SD card, that doesn't boot, in another running OS and then run the program from the running OS. How does it know to make the changes to the mounted OS and not the running OS?

Thank you,

Flex

feelslikeautumn
Posts: 73
Joined: Wed Aug 09, 2017 9:51 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Tue Sep 12, 2017 11:52 am

What you've described in earlier posts seems correct. It does seem very odd that gparted is changing the uuid. If we accept that this is designed behaviour (however crazy), my guess (and it is a wild guess) is that the filesystem is being corrupted somehow and causing the boot to take longer than normal. Without seeing what is happening it is very hard to tell.

Can you write the image to sd card. Change the cmdline.txt and fstab to use /dev/mmcblk0etc . See if it boots with those changes. If it does then shrink the partition. Run fsck on it. See if it boots now.

RonR
Posts: 78
Joined: Tue Apr 12, 2016 10:29 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Tue Sep 12, 2017 12:45 pm

Write a virgin Raspbian image to a fresh SD card and boot it. Copy set-boot to that SD card (using WinSCP or something similar) and make it executable (chmod +x set-boot). Put the problematic SD card in a USB adapter/reader and plug it into one of Pi's USB ports. Confirm the problematic SD card's device name is /dev/sda using blkid. Then run:

./set-boot /dev/sda /dev/mmcblk0

This will set the problematic SD card's /boot/cmdline.txt and /etc/fstab files up with the proper /dev/mmcblk0 p1/p2 notation (verify this with cat or nano). Shutdown and try to boot the problematic SD card.

If the problematic SD card still won't boot, it's likely you hosed it in your attempts to shrink it.

FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Tue Sep 12, 2017 8:39 pm

Hello,

I tried again replacing the partition references in the cmdline.txt and /etc/fstab with /dev partition references and this time it DID work. So I was able to rescue my original September Raspbian Stretch Lite image from two days ago after all. Maybe I was making a typo when I tried doing this two days ago.

I also re-flashed a September Raspbian Stretch Lite image this time to a 4GB sd card... I then made a back up, I then resized it using GParted so the root partition was just a little bigger than the amount of space actually being taken up by the filesystem... I then put this card back in the Pi expecting that it would not boot......... but it DID boot ! I looked at the partition references in those two files and they were both still PART-GUUID references so GParted didn't mess with the partition references that Raspbian gave those files originally.

I don't understand this because I thought that Raspbian images since April 2017 would not boot after a resize with Parted OR GParted because it does mess with these partition references. https://raspberrypi.stackexchange.com/q ... -partition This apparent inconsistency is part of the joys of life I suppose!

Thanks to everyone who helped out.

Flex
Last edited by FlexMcMurphy on Tue Sep 12, 2017 9:19 pm, edited 1 time in total.

RonR
Posts: 78
Joined: Tue Apr 12, 2016 10:29 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Tue Sep 12, 2017 9:16 pm

It's very easy to make mistakes when running resize2fs and fdisk/gparted manually.

Try this script (image-shrink) for shrinking image files:

Usage:

image-shrink imagefile [Additional MB]

The image file will be shrunk to its absolute minimum size plus an optional number of additional megabytes.
Attachments
image-shrink.zip
(999 Bytes) Downloaded 9 times

FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Tue Sep 12, 2017 9:47 pm

Cheers RonR,

How do I make the image file to work with this shell script? Normally I use a program called: Active Disk Image that creates a file with extension .adi which already compresses the SD Card contents when it makes the image.

Does this script look inside the SD card "image" and know how much it is safe to reduce the size of the root partition? Does it matter how many partitions are on the card... I had a quick google there and some of these types of scripts only work under certain conditions.

Flex

RonR
Posts: 78
Joined: Tue Apr 12, 2016 10:29 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Tue Sep 12, 2017 9:58 pm

I'm familiar with Active Disk Image as I use it for daily backups of my Windows PC. It's not clear to me how you're using it with a Raspberry Pi and SD cards. I assumed you were creating image files of an SD card with dd, rpi-clone, or something similar. Please explain how you're using Active Disk Image with a Raspberry Pi.

FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Tue Sep 12, 2017 10:47 pm

Hello,

Start Active Disk Image > Disk to Image > Click checkbox beside 'Disk1' to backup both its partitions > Select a folder to save backup image files to and give the backup a name. Leave compression at normal, leave Image Splitting as Automatic > next > Start.

You can also do the reverse using Active Disk Image to put the .adi file back on an SD card.

I've been making backups this way all along but first shrinking down the root partition using GParted so the backup image isn't huge and it can be flashed to smaller SD cards.

I'll try rpi-clone or dd to make an image file then give that script a try. I'd prefer not to use (G)Parted anymore.

Flex

RonR
Posts: 78
Joined: Tue Apr 12, 2016 10:29 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Tue Sep 12, 2017 11:57 pm

Using Active Disk Image is a novel way to create SD card backups, but it's rather inconvenient to have to shut down the Pi, transfer the SD card to an adapter in the PC. and run ADI. The resulting image file is a proprietary format and can only be manipulated and restored using ADI.

dd works, but it copies the entire SD card, including all unused space, which is time consuming and bulky. You could use my image-shrink to squish it down, but then it's multiple steps. I've never used rpi-clone, but I assume it works well.

The attached image-backup will create a backup of the running SD card to a standard 'raw' image file that can be written to a new SD card with etcher, imageUSB, etc. It will also do incremental updates to the backup image.

Running image-backup with no parameters will create a full backup. To create the smallest image, specify an image size of 0 to determine the minimum size. If you plan to incrementally update it, use a considerably larger size to allow for additional growth. Do NOT create the backup image file on the running SD card (use a flash drive or Windows share for the destination).

Running image-backup with a parameter of an existing image filename will incrementally update that image file.

I run a cron job that does an incremental update at 4 am daily so I've always got a current backup.
Attachments
image-backup.zip
(2.18 KiB) Downloaded 10 times

FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Wed Sep 13, 2017 8:32 pm

RonR,

Howsit goin'?!

Thanks for that bash script. I've got a good feeling about it! I like that I could just run it on my SD card without having to take it out of the Pi and then it makes not just an image but an image that isn't huge.

I made image-backup executable and installed it in /usr/local/bin and it does run. Only thing is I don't really know how to run it? What parameters does it accept? I have a 60GB USB key plugged in to the Pi at /dev/sda. What is the Linux incantation to make an image of my running Raspbian OS and save it on to the USB key at /dev/sda?

Here is what I have tried...

Code: Select all

sudo fdisk -l // and apparently the USB key is at /dev/sda1
sudo  mkdir /media/usb
sudo mount /dev/sda1 /media/usb // and it does mount. Verified by browsing in Windows 7 via Samba
image-backup /dev/sda1
But I get the error message: /dev/sda1 not found

What am I doing wrong?

Thanks a bunch,

Flex

RonR
Posts: 78
Joined: Tue Apr 12, 2016 10:29 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Wed Sep 13, 2017 9:01 pm

To create the initial full backup, run image-backup with no parameters:

sudo image-backup

image-backup will prompt:

Image file to create? /media/usb/whatever.img

Image ROOT filesystem size (MB) [xxxxx]?

(Hitting return will create an image file capable of holding a totally full ROOT filesystem. If you want to create an absolute minimum size image file, enter 0 to see the minimum size permitted. If you want to allow for incremental updates, enter a size larger than the minimum size to allow for expansion.)

Create /media/usb/whatever.img [xxxxx MB] (y/n)? y

To incrementally update the image file, run:

sudo image-backup /media/usb/whatever.img

image-backup will silently add, delete, and update files in the image file to match your running system.

FlexMcMurphy
Posts: 36
Joined: Mon May 19, 2014 3:47 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Wed Sep 13, 2017 10:39 pm

RonR,

You are A legend !

It worked great.. I made a backup .img file (a few 100MB larger than the space occupied by the root filesystem) on my USB key from the running Raspbian OS which I then dragged and dropped to my Windows 7 backup folder via Samba. I was then able to flash that backup image to a different SD card plugged in to the SD card reader on my Win 7 laptop using "Win32 Disk Imager". This SD Card then booted up in the Pi and I used raspi-config to inflate the partition to occupy the whole SD card.

This is a much easier workflow then having to open up GParted on my Ubuntu VM to reduce the size of the root partition and then (potentially??) have to change the cmdline.txt and /etc/fstab files after the re-size in case the partition references changed. And then make then make a back up image in Active Disk Image.. which as you say, is only compatible with the ADI tool.

My only gripe? The image it created was 1.8GB. I asked it to create a file that big using your program. But Active Disk Image made me a 580MB backup image of the same basic Raspbian Stretch Lite installation. So your script works great but doesn't have any compression. I wonder could you add that?

Great work,

Flex

RonR
Posts: 78
Joined: Tue Apr 12, 2016 10:29 pm

Re: Cannot resize Raspbian Stretch lite images with Parted

Wed Sep 13, 2017 10:58 pm

image-backup could compress the image file when it finishes, but then the image file would have to be decompressed before it could be written to a new SD card using etcher, imageUSB. or whatever. image-backup would also have to decompress the image in order to do an incremental update before being compressed again. Way too time consuming. You can use gzip, WinRAR, PKZip, or whatever if you want to archive it in a smaller form.

User avatar
pi-anazazi
Posts: 382
Joined: Fri Feb 13, 2015 9:22 pm
Location: EU

Re: Cannot resize Raspbian Stretch lite images with Parted

Thu Sep 14, 2017 8:03 am

... unbelievable thread here. As fruity pointed out in the very beginning: Use piclone, it resized to whichever size you want. In just 5 minutes you're done.
Kind regards

anazazi

Return to “Raspbian”

Who is online

Users browsing this forum: No registered users and 25 guests