In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the example analysis about Raspberry Pi OS prohibiting automatic extension of TF card and setting root partition size. the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Raspberry pie can easily cause damage to the TF card in the event of a sudden power outage. I need to create another partition to save data, and the system partition setting is read-only to protect the TF card.
It is difficult to reduce the size of a partition on Linux, but it is much easier to expand the capacity of a partition.
Raspbian based on Debian Buster executes scripts to extend the system partition to the entire TF card when the system starts for the first time. If you need to create additional partitions, this feature needs to be disabled. The implementation of Raspbian automatic extension TF card:
Init=/usr/lib/raspi-config/init_resize.sh at the end of / boot/cmdline.txt, this script modifies the size of the root partition to extend it to a real TF card
/ etc/init.d/resize2fs_once random startup script resize2fs modifies the file system size and deletes the file itself.
It's easy to know this. After burning the TF card, don't insert the raspberry to run it immediately. You should modify the TF card on your computer.
Delete the string init=/usr/lib/raspi-config/init_resize.sh at the end of / boot/cmdline.txt
Delete / etc/init.d/resize2fs_once script with resize2fs $ROOT_DEV & & that line
Fdisk operates the TF card, recreates the partition and adds size. My computer is sudo fdisk / dev/sdb
Sudo fdisk / dev/sdbWelcome to fdisk (util-linux 2.31.1) .Changes will remain in memory only Until you decide to write them.Be careful before using the write command.Command (m for help): mHelp: DOS (MBR) a toggle a bootable flag b edit nested BSD disklabel c toggle the dos compatibility flag Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition Misc m print this menu u change display / entry units x extra functionality (experts only) Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file Save & Exit w write table to disk and exit q quit without saving changes Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition tableCommand (m for help): pDisk / dev/sdb: 14.6 GiB 15665725440 bytes, 30597120 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x2fed7feeDevice Boot Start End Sectors Size Id Type/dev/sdb1 8192 532479 524288 256M c W95 FAT32 (LBA) / dev/sdb2 532480 3620863 3088384 1.5G 83 LinuxCommand (m for help): dPartition number (1 primary, default 2): 2Partition 2 has been deleted.Command (m for help): nPartition type p primary (1 primary, 0 extended) 3 free) e extended (container for logical partitions) Select (default p): pPartition number (2-4, default 2): First sector (2048-30597119, default 2048): 532480Last sector, + sectors or + size {K contains M default P} (532480-30597119, default 30597119): + 6GCreated a new partition 2 of type 'Linux' and of size 6 GiB.Partition # 2 contains an ext4 signature.Do you want to remove the signature? [y] es/ [N] o: nCommand (m for help): wThe partition table has been altered.Calling ioctl () to re-read partition table.Syncing disks.$ sudo e2fsck-f / dev/sdb2e2fsck 1.44.1 (24-Mar-2018) Pass 1: Checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: Checking directory connectivityPass 4: Checking reference countsPass 5: Checking group summary informationrootfs: 44456 non-contiguous 96576 files (0.2% non-contiguous) 292342 blocks$ sudo resize2fs / dev/sdb2 6Gresize2fs 1.44.1 (24-Mar-2018) Resizing the filesystem on / dev/sdb2 to 1572864 (4k) blocks.The filesystem on / dev/sdb2 is now 1572864 (4k) blocks long.
Now you can start the raspberry pie with this TF card. I only set 6G for the root partition. After entering raspbian, you can partition the remaining space, and cfdisk is more intuitive.
Sudo cfdisk / dev/mmcblk0
After seeing that the size of df-h and fdisk-l is not the same, fix it with the following command
This is the example analysis of sudo resize2fs / dev/mmcblk0p2 that forbids automatic expansion of TF cards by Raspberry Pi OS and sets the size of the root partition. I hope the above content can be helpful to you and learn more. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.