맛집 여행 캠핑 일상 생활

[OpenWrt] root partition 확장 방법 본문

OpenWrt

[OpenWrt] root partition 확장 방법

영은파더♥ 2024. 11. 11. 12:00
728x90

라즈베리파이2 에 OpenWrt 를 설치했는데 루트 파티션이 SD Card 일부만 잡혀있네요~

opkg update
opkg install fdisk lsblk
opkg install parted losetup resize2fs

부팅 후 opkg update 한 적이 없다면 한번은 update를 해줘야 하는 단점이 있습니다.

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                98.3M     20.3M     76.0M  21% /
tmpfs                   463.8M      1.0M    462.8M   0% /tmp
/dev/mmcblk0p1           63.9M     29.0M     34.9M  45% /boot
tmpfs                   512.0K         0    512.0K   0% /dev

root@OpenWrt:~# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
mmcblk0     179:0    0 29.1G  0 disk
├─mmcblk0p1 179:1    0   64M  0 part /boot
└─mmcblk0p2 179:2    0  104M  0 part /

df 와 lsblk 로 용량을 확인해보면 표기가 조금은 다르지만 root 파티션이 대략 100메가 정도만 잡혀있습니다.
남아있는 29G 모두 root 파티션을 확장하는 방법을 검색해서 찾아보았습니다.
https://openwrt.org/docs/guide-user/advanced/expand_root

 

[OpenWrt Wiki] Expanding root partition and filesystem

Expanding root partition and filesystem # Configure startup scripts cat << "EOF" > /etc/uci-defaults/70-rootpt-resize if [ ! -e /etc/rootpt-resize ] \ && type parted > /dev/null \ && lock -n /var/lock/root-resize then ROOT_BLK="$(readlink -f /sys/dev/block

openwrt.org

위의 링크를 참고하시면 됩니다.

root@OpenWrt:~# wget -U "" -O expand-root.sh "https://openwrt.org/_export/code/docs/guide-user/advanced/expand_root?codeblock=0"
Downloading 'https://openwrt.org/_export/code/docs/guide-user/advanced/expand_root?codeblock=0'
Connecting to 64.226.122.113:443
Writing to 'expand-root.sh'

Download completed (1197 bytes)

root@OpenWrt:~# chmod 700 expand-root.sh

root@OpenWrt:~# ./expand-root.sh

이제 확장이 되었는지 확인해보겠습니다.

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                98.3M     20.3M     76.0M  21% /
tmpfs                   463.8M      1.0M    462.8M   0% /tmp
/dev/mmcblk0p1           63.9M     29.0M     34.9M  45% /boot
tmpfs                   512.0K         0    512.0K   0% /dev

root@OpenWrt:~# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
mmcblk0     179:0    0 29.1G  0 disk
├─mmcblk0p1 179:1    0   64M  0 part /boot
└─mmcblk0p2 179:2    0  104M  0 part /

root@OpenWrt:~# sync
root@OpenWrt:~# reboot

재부팅해야 제대로 인식이 될 것 같네요~

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                28.7G     20.3M     28.6G   0% /
tmpfs                   463.8M     64.0K    463.7M   0% /tmp
/dev/mmcblk0p1           63.9M     29.0M     34.9M  45% /boot
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
mmcblk0     179:0    0 29.1G  0 disk
├─mmcblk0p1 179:1    0   64M  0 part /boot
└─mmcblk0p2 179:2    0 29.1G  0 part /

재부팅하고 확인을 하니 제대로 확장이 되어있네요~

 

728x90
반응형
Trackback : | Comments :