0

I need to reduce the size on my Raspberry Pi boot SD card. I have read this posting Reverse the expand root FS and it embedded references, but as a near novice, I have a couple questions.

I can mount a USB memory stick on my Pi which is empty and bigger than the SD card being used to boot up the Pi. Can I run the process detailed in the above reference from that Pi, using the USB memory stick as the target for the process?

And then mount a second USB device with a micro SD card to do the final copy/creation of the new boot SD?

Thanks....RDK

RDK
  • 201
  • 3
  • 10
  • 1
    Your question is unclear. If what you want to do is copy your SD to another/smaller SD you can do this with a SD Card reader using the SD Copy utility include in Raspbian. – Milliways Dec 27 '16 at 07:18
  • My setup for this problem is Wheezy. The Copy SD card utility is only on Jessie. I have tried to install the SD copy (PiClone) on my Wheezy but it is missing too many things. Thus, my problem and question remains, using the process detailed in the link, can I do all of it on my Pi using an external USB memory stick and external USB read/write adapter for the new SD card image. – RDK Dec 27 '16 at 12:17

1 Answers1

0

Can I run the process detailed in the above reference from that Pi, using the USB memory stick as the target for the process?

Yes, but just to be clear, you are creating the image in a file. Obviously that file has to be stored somewhere, and a USB stick should be fine for that.

In addition, because that file is then formatted as a device image containing several partitions with filesystems that are independently formatted and mounted, the filesystem on the stick doesn't have to be the same, or anything in particular. In other words, you could use a standard, preformatted (FAT32, whatever) USB stick and create the device image file there.

goldilocks
  • 58,859
  • 17
  • 112
  • 227
  • ok, I'll give it a try in the next day or so. Thanks – RDK Dec 28 '16 at 05:12
  • If you've never done it before it is probably worth going through the basic motions once with a small test like in the original answer -- create a file, turn it into a device image with fdisk, format a partition on it, check that you can mount that, copy some files into it, unmount it, mount it again and check everything you did is still there, etc. It's really pretty simple and only takes a few minutes; I think people may get intimidated if the concepts are hazy -- then they deal with it like cargo cult magic. – goldilocks Dec 28 '16 at 13:20
  • If it isn't totally clear to you and you have not read the other answer linked at the top that is probably worth a once through. Human errors tend to be the result of human misunderstanding. ;) – goldilocks Dec 28 '16 at 13:20
  • GL...Have the other references and I have read through them once. I will, for sure, study them again before doing anything serious. And, I always backup my SB cards before experiments like this. Thanks for your concerns and suggestions. Today, my day has been full as I blew a power supply on my local file and web server. Lots of fun.... – RDK Dec 28 '16 at 19:52
  • goldilocks....You are correct, the process is a bit intimidating for a near novice. In your original article (Reverse Expand Pi root FS) you say "In the Raspbian image this partition is ~56 MB ... In this example, though, there isn't enough space, so I used 10 MB.". I don't see/understand this in your example? Further down you show the Partition Table to to get the starting sector for the second partition. How did you generate this table at this point in the process? – RDK Dec 30 '16 at 08:34
  • goldilocks.... I'm studying the "rsync backup" reference, trying understand/figure out which parts get transferred and to which of the two new partitions/file images? Would appreciate any comments or help you might offer. – RDK Dec 30 '16 at 08:40
  • I added a few lines to the original answer demonstrating in further detail the use of fdisk -- much of which (e.g., how to use 10 MB or whatever) should be extremely obvious if you actually try it. Nothing is going to explode. You can delete the test file afterward. It's meaningless. It does not matter how right or wrong you do it or how many tries it takes you to understand. You can only learn so much about driving a car by reading an explanation. You need to go to a empty parking lot and drive the car around. Etc. – goldilocks Dec 30 '16 at 12:09
  • The stuff about rsync refers to this answer, (which is linked at the beginning). You'll probably find hundreds of explanations of both rsync and fdisk online. For your test just copy a small tree...your home directory or something. Choose things at random for the exclude-from. Check to make sure it does what you think it does, play around until you are comfortable you understand. It really is not rocket science -- no fuel costs, no risk of bodily harm or property damage. ;) – goldilocks Dec 30 '16 at 12:09
  • Thanks. As a retired scientist, I understand experimenting. Perhaps if I explain my project: I have a Pi which probably only needs an 8 GB SD card, but as I only had a 32 when I was testing a new setup I use that. Now I don't want to continue with that big of a SD card. Thus my goal is to produce a Raspberry Pi boot SD which will fit on an 8 GB SD card, of course assuming that I can reduce the filesystem to that size. Thus, my question is which, of the partitions you discussed in your article about using rsync as a backup tool, should I copy and to which of the two partitions? Thanks – RDK Dec 30 '16 at 12:28
  • You want to duplicate the card. A stock Raspbian image contains two partitions, the small boot partition and the large root filesystem partition. If you burn that to a card, you end up with the same thing. You want to do the same thing in reverse, so you need to copy both partitions from the card to the image file -- the first partition's contents go into the first partition, the second into the second. The second one (the root fs) is much bigger and has a more complex structure, which is why it is the focus of the rsync discussion (esp. re. not copying certain things from a live system). – goldilocks Dec 30 '16 at 13:08
  • If you are doing this from the Pi to a USB stick, one thing to watch out for, as per the rsync discussion, is to exclude the /mnt directory or wherever the USB stick is mounted (it may be in /media; mount | grep /dev/sd may help determine this). Otherwise what you are copying includes where you are copying it to (which can create an endless loop that just keeps going until you run out of target space). But with the boot partition it's easy, you want everything as is (and it is just one or two folders of stuff). – goldilocks Dec 30 '16 at 13:08