티스토리 뷰

728x90

출처

설치

bluesanta@bluesanta-desktop:~$ wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
bluesanta@bluesanta-desktop:~$ chmod +x pishrink.sh
bluesanta@bluesanta-desktop:~$ sudo mv pishrink.sh /usr/local/bin

이미지(img) 파일 압축

bluesanta@bluesanta-desktop:~$ sudo pishrink.sh Orangepi3b_1.0.4_ubuntu_jammy_desktop_xfce_linux5.10.160_oracle19ee.img 
pishrink.sh v0.1.4
pishrink.sh: Gathering data ...
Creating new /etc/rc.local
pishrink.sh: Checking filesystem ...
opi_root: 276308/3781440 files (0.3% non-contiguous), 7355461/15322107 blocks
resize2fs 1.46.5 (30-Dec-2021)
pishrink.sh: Shrinking filesystem ...
resize2fs 1.46.5 (30-Dec-2021)
Resizing the filesystem on /dev/loop15 to 7734996 (4k) blocks.
Begin pass 2 (max = 543805)
Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 468)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 22279)
Updating inode references     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/loop15 is now 7734996 (4k) blocks long.
 
pishrink.sh: Shrinking image ...
pishrink.sh: Shrunk Orangepi3b_1.0.4_ubuntu_jammy_desktop_xfce_linux5.10.160_oracle19ee.img from 60G to 31G ...

gzip으로 파일 압축

bluesanta@bluesanta-desktop:~$ gzip Orangepi3b_1.0.4_ubuntu_jammy_desktop_xfce_linux5.10.160_oracle19ee.img

용량 확장

용량 확인

orangepi@orangepi3b:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           769M  8.9M  761M   2% /run
/dev/mmcblk1p2   32G   30G  1.6G  96% /
tmpfs           3.8G     0  3.8G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.8G   12K  3.8G   1% /tmp
/dev/mmcblk1p1 1022M  123M  900M  12% /boot
/dev/zram1       47M  2.5M   41M   6% /var/log
tmpfs           769M   72K  769M   1% /run/user/1000

디스크 확인

orangepi@orangepi3b:~$ sudo fdisk -l | grep '^Disk'
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
GPT PMBR size mismatch (8191 != 32767) will be corrected by write.
Disk /dev/zram0: 3.75 GiB, 4031479808 bytes, 984248 sectors
The backup GPT table is not on the end of the device.
Disk /dev/mtdblock0: 16 MiB, 16777216 bytes, 32768 sectors
Disklabel type: gpt
Disk identifier: 3633529D-D43A-43ED-89B5-3C77E84E30AB
GPT PMBR size mismatch (122879999 != 124735487) will be corrected by write.
Disk /dev/mmcblk1: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Disklabel type: gpt
Disk identifier: E62EC91A-B5E0-F340-9BEA-2D2DB623FE25
Disk /dev/zram1: 50 MiB, 52428800 bytes, 12800 sectors

기존 파티션을 삭제하고 새로 파티션 생성

orangepi@orangepi3b:~$ sudo fdisk /dev/mmcblk1
 
Welcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
GPT PMBR size mismatch (122879999 != 124735487) will be corrected by write.
This disk is currently in use - repartitioning is probably a bad idea.
It's recommended to umount all file systems, and swapoff all swap
partitions on this disk.
 
 
Command (m for help): p
 
Disk /dev/mmcblk1: 59.48 GiB, 63864569856 bytes, 124735488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: E62EC91A-B5E0-F340-9BEA-2D2DB623FE25
 
Device           Start      End  Sectors  Size Type
/dev/mmcblk1p1   61440  2158591  2097152    1G Linux extended boot
/dev/mmcblk1p2 2158592 68800384 66641793 31.8G Linux filesystem
 
Command (m for help): d
Partition number (1,2, default 2): 2
 
Partition 2 has been deleted.
 
Command (m for help): n
Partition number (2-128, default 2): 2
First sector (2048-124735454, default 2158592): 2158592
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2158592-124735454, default 124735454): 
 
Created a new partition 2 of type 'Linux filesystem' and of size 58.4 GiB.
Partition #2 contains a ext4 signature.
 
Do you want to remove the signature? [Y]es/[N]o: Y
 
The signature will be removed by a write command.
 
Command (m for help): w
The partition table has been altered.
Syncing disks.
 
orangepi@orangepi3b:~$ sudo shutdown -r now

변경한 파티션으로 사이즈 변경

orangepi@orangepi3b:~$ sudo resize2fs /dev/mmcblk1p2
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/mmcblk1p2 is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 4
The filesystem on /dev/mmcblk1p2 is now 15322107 (4k) blocks long.

용량 확인

orangepi@orangepi3b:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           769M  8.9M  761M   2% /run
/dev/mmcblk1p2   58G   30G   28G  52% /
tmpfs           3.8G     0  3.8G   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.8G   12K  3.8G   1% /tmp
/dev/mmcblk1p1 1022M  123M  900M  12% /boot
/dev/zram1       47M  3.4M   41M   8% /var/log
tmpfs           769M   72K  769M   1% /run/user/1000
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함