라즈베리파이 등을 사용할 때, Root Filesystem의 size가 실제 SD 카드의 사이즈 보다 작게 인식 되는 경우가 있다.

라즈베리 파이의 경우에는 raspi-config를 사용하여 resize 할 수 있지만,

일반적인 Command를 사용해서 resize 하는 방법은 아래와 같다.

해당 과정 중에 문제가 생기는 경우 Kernel panic으로 다시 살릴 수 없기에 SD카드를 백업해 둘 것을 추천한다.

 - 백업은 win32 DiskImager로 Read 하면 이미지로 백업 가능. 추후 write로 복원


1. 현재 partition 확인

fdisk 로 device 정보 확인 후,

$ fdisk -l


해당 디바이스의 사이즈가 실제 디바이스의 사이즈보다 작은 경우

partition table을 다시 작성해준다.

이 때, partition table Start sector를 확인해 둔다.

$ fdisk /dev/mmcblk0


우선 기존의 작게 인식되는 partition을 삭제해 준다.

Command (m for help): d

Partition number (1,2, default 2): 2


새로 partition을 추가 한다.

이때, start sector가 위에서 확인한 기존 partition table과 일치해야 kernel panic이 나지 않을 것이다.

Command (m for help): n

Partition type

p    primary (1 primary, 0 extended, 3 free)

e     extended (container for logical partitions)

Select (default p): p

Partition number (2-4, default 2): 2

First sector (2088450-31116287, default 2088960): 2088450

Last sector, +sectors or +size{K,M,G,T,P} (2088450-31116287, default 31116287): 


작성된 partition table을 저장 하고 종료한다.

Command (m for help): w


현재 사용 중인 시스템에서는 partition table을 다시 작성한 것이 재부팅 후에 인식이 되므로, 시스템을 재부팅 해준다.

$ shutdown -r now


재부팅 된 시스템에서, partition 사이즈가 제대로 인식이 되는지 확인한다.

$ fdisk -l


제대로 인식이 됐다면, resize를 해준다.

$ resize2fs /dev/mmcblk0p2


끗.

'Programming > RaspberryPi' 카테고리의 다른 글

Rasbian qbittorrent-nox installation  (0) 2019.11.19
SD card image backup  (0) 2018.10.12
RaspberryPi Remote Desktop Client  (0) 2018.06.01
Raspbian Korean(Hangul) Install  (0) 2018.05.18
Raspbian Install  (0) 2018.05.16

+ Recent posts