說多了都是淚,各種內存不足,我明明用的16G的卡怎么就識別了7.2G然后各種百度,還整壞了一次系統。。。。。
謝天謝地我備份了鏡像~
廢話少說直接看方法吧!
首先來查看一下系統的磁盤情況
df -h
Paste_Image.png
你會發現:樹莓派只識別出2.9G的容量,雖然如此,但是還是由辦法解決的。
解決辦法:
pi@raspberrypi ~ $ df -h #查看當前磁盤大小,總大小只有2.9GB Filesystem Size Used Avail Use% Mounted on rootfs 2.9G 2.8G 15M 100% / /dev/root 2.9G 2.8G 15M 100% / devtmpfs 214M 0 214M 0% /dev tmpfs 44M 244K 44M 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 88M 0 88M 0% /run/shm /dev/mmcblk0p1 56M 19M 37M 34% /boot tmpfs 88M 0 88M 0% /tmp pi@raspberrypi ~ $ cat /sys/block/mmcblk0/mmcblk0p2/start # 查看第二分區的起始地址,后面會用到 122880 pi@raspberrypi ~ $ sudo fdisk /dev/mmcblk0 #使用fdisk操作磁盤 Command (m for help): d #d,刪除分區 Partition number (1-4): 2 # 2,刪除第二分區 Command (m for help): n #創建一個新分區 Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p #創建主分區 Partition number (1-4, default 2): 2 #分區2 First sector (2048-7744511, default 2048): 122880 #輸入第一次得到的第二分區起始扇區 Last sector, +sectors or +size{K,M,G} (122880-7744511, default 7744511): #最后一個sector,默認即可Enter Using default value 7744511 Command (m for help): w #將上面的操作寫入分區表 The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. pi@raspberrypi ~ $ sudo reboot #設置完成需要重啟,sudo reboot
Paste_Image.png
重啟完成之后,此時查詢也還是沒有變化的,還需要如下命令
sudo resize2fs /dev/mmcblk0p2
這時你再來查詢樹莓派的系統磁盤的容量就擴展啦,看圖!
Paste_Image.png
這樣就可以解決樹莓派只識別出SD卡2.9G的容量的問題!
尊重一下作者:
作者:AlicFeng
鏈接:https://www.jianshu.com/p/6588f935d41c
來源:簡書
簡書著作權歸作者所有,任何形式的轉載都請聯系作者獲得授權並注明出處。
重要提示:如果在你創建完新的分區以后問你要不要刪除一個東西,千萬別刪,刪了就開不了機了!
