Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use PiShrink in linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Xiaobian to share with you how to use PiShrink in linux, I believe most people still do not know how, so share this article for everyone's reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

Install PiShrink

To install PiShrink on a Linux machine, first download the *** version using the following command:

$ wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh

Next, turn the downloaded PiShrink into a binary executable file:

$ chmod +x pishrink.sh

***, move to directory:

$ sudo mv pishrink.sh the Raspberry Pi image smaller

As you may already know, Raspbian is the official operating system for all Raspberry Pi models. The Raspberry Pi Foundation has developed desktop versions of the Raspberry Pi for PC and Mac. You can create a live CD and run it in a virtual machine or even install it on your desktop. Raspberry Pi also has a small number of unofficial operating system images. For testing purposes, I downloaded the official Raspbian system from the official download page.

Unzip the downloaded system image:

$ unzip 2019-04-08-raspbian-stretch-lite.zip

The above command extracts the contents of the 2019-04-08-raspbian-stretch-lite.zip file in the current directory.

Let's look at the actual size of the extracted file:

$ du -h 2019-04-08-raspbian-stretch-lite.img1.7G 2019-04-08-raspbian-stretch-lite.img

As you can see, the extracted Raspberry Pi system image size is 1.7G.

Now, use PiShrink to reduce the size of this file as follows:

$ sudo pishrink.sh 2019-04-08-raspbian-stretch-lite.img

Example output:

Creating new /etc/rc.localrootfs: 39795/107072 files (0.1% non-contiguous), 239386/428032 blocksresize2fs 1.45.0 (6-Mar-2019)resize2fs 1.45.0 (6-Mar-2019)Resizing the filesystem on /dev/loop1 to 280763 (4k) blocks.Begin pass 3 (max = 14)Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXBegin pass 4 (max = 3728)Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXThe filesystem on /dev/loop1 is now 280763 (4k) blocks long. Shrunk 2019-04-08-raspbian-stretch-lite.img from 1.7G to 1.2G

As you can see in the output above, the size of the Raspberry Pi image has been reduced to 1.2G.

You can also use the-s flag to skip the automatic extension part of the process.

$ sudo pishrink.sh-s 2019-04-08-raspbian-stretch-lite.img newpi.img The above is "How to use PiShrink in linux" All the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report