Moving a configured Raspbian partition?

I have an SD containing a NOOBS-installed Raspbian, that over the
months has become considerably expanded with downloads and my own
stuff. Now I'd like to maximize the space by getting rid of the
'recovery' partition, and devoting the whole thing to linux.
However, I'm not really sure of my options for doing this.
For a start, I'm intending to dd the relevant partitions (boot
& root) off to a flash-drive or somewhere (on my laptop, not the
Pi). Then I assume I can eventually dd them back onto the front
of the SD.
There are several areas where I'm somewhat in the dark, though.
I guess I probably should partition the SD to the desired sizes
first, otherwise I'd have no (or a bad) partition table (?).
The 'boot' partition I assume has a suitable VBR? Or will that
be wrecked by moving it?
I notice that the boot partition is FAT32 (also on the Raspbian
image that I've just downloaded as well). Why is this? A feature
of Broadcom? (My Linux-based laptop of course doesn't do that.)
A backup plan is to install the downloaded image and then rebuild
the system from the preserved original. I did that before, though,
using rsync, and it was thoroughly tedious. Mainly because there
are root-access-only files, and there is no root password!
I guess I could probably solve that simply by assigning a password,
but if somehow I could do a direct copy it'd be nicer.
Hmmm. Another option has just occurred to me. If I change the
partition table to have 'boot' the active partition, can I then
just reformat the recovery partition as ext4 and gain access as
a storage area?
Thanks for any suggestions.
-- Pete --
The address in the header is a Spam Bucket -- don't bother replying to it... 
 Click to see the full signature
Reply to
Loading thread data ...
Just dd the two partitions off to your laptop. Repartition the card to have just two partitions.
The first partition must be FAT32 (yes, it is a feature of the BCM238x chips) and contains /boot. Make that one the same size as your original /boot partition.
The second partition will be Linux ext4 and should fill the rest of the card.
Then dd the contents into the new partitions.
You will need to edit the file cmdline.txt in the boot partition and set root=/dev/mmcblk0p2
You do not need to set any partition as active/boot. That flag is ignored.
That should then boot straight into Raspbian.
You can then run resize2fs /dev/mmcblk0p2 to expand the root filesystem to use the full size of the partition.
Reply to
Ahh, excellent! That's all very clear and straightforward.
-- Pete
The address in the header is a Spam Bucket -- don't bother replying to it... 
 Click to see the full signature
Reply to
Or set the partitions by downloading the latest Raspbian iso, and dd it to the SD card. Mount it on your laptop and erase the files in the ext4 partition. Then cp -a the ext4 filesystems from the old to new via your laptop. Easy.
Reply to
Dave Farrance
On Wed, 11 Mar 2015 21:12:41 -0500, Pete , > I have an SD containing a NOOBS-installed Raspbian, that over the
So you want to delete a partition, and then expand the ext? filesystem to reclaim that space.
I would recommend gparted
formatting link

You can get it either from their download site as a live cd. But it is also included in many other live cd/dvds, such as SysRescueCd:
formatting link
. I find that one to be very useful and keep a reasonably up-to-date copy handy. You'll want to do this on your laptop.
Make backups in case something goes sideways. I've never had a problem with gparted that wasn't user induced. The most time consuming part will be the download and then creating a bootable device.
Consulting Minister for Consultants, DNRC 
I can please only one person per day. Today is not your day. Tomorrow 
 Click to see the full signature
Reply to
I R A Darth Aggie
Well, not totally easy... (:-/)
It took a couple of days of research before I felt comfortable starting on the job. I still am not all the way to my original intention, but here's where I am so far:
First I actually had a spare SD that I'd been hoarding until I decided what it would best be used for, and realized that cloning my configured system onto that would *be* its best use. Once that was done, I could mess with the NOOBS-based card.
So I essentially followed your advice, Dave, and dd'd the downloaded Raspbian image onto that. (You missed out the step of booting it in the Pi to actually expand the partition...)
I then put my NOOBS card into the laptop and copied /root to a directory on my hard drive with 'sudo cp -a...'. Switched to the new card and did the reverse operation back to the new root. Just what you suggested, except that I didn't bother to erase the original contents, figuring that it would be a subset of what I was reloading. I was a bit surpised to see the size did actually increase (by ~600MB out of 3.2G) so I guess my assumption wasn't quite true. Not sure what's extra, but I don't expect trouble.
Trouble did occur, though, when I booted the overlaid card. It complained about a bad file system(!), and waited for me to either go into maintenance or continue with ^D. I elected to continue, and the system then did come up OK.
When it failed, it reported that the cause had been noted in a log, but of course that said nothing...! Fortunately I'd observed that the failure message had complained about a missing '/dev/mmcblk0p5', which is of course where the *old* boot partition was. That was soon tracked down to /etc/fstab, and fixing that gave me a fully bootable system.
The only remaining problem [so far!] is that I had no sound, due to now having a default config.txt in the boot partition. Quickly fixed.
Once I'm satisfied that my new card is fully functional, I'll do what I originally intended and try to gain the space from the NOOBS partition on the old card. The suggestion to use GParted (which I do already have) seems reasonable, but I'm not at all sure that it'll actually work.
One thing that has me fairly confused is that I see in my scouring of the web that 'parted' -- as distinct from gparted -- apparently no longer allows moving and resizing filesystems! And I've understood that gparted is just a GUI for parted. OTOH the gparted docs seem to happily assume it will manipulate ext filesystems. And a quick dummy run shows the menu items enabled. I'm sort of assuming that it calls out to resize2fs or something to actually do the job?
The other thing I have a feeling may stick me is that /root and /boot are currently logical partitions, whereas they will need to become physical ones. Can gparted do that?
I guess we'll see. I'll let you know.
Thanks, -- Pete --
The address in the header is a Spam Bucket -- don't bother replying to  
 Click to see the full signature
Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.