2016年12月23日 星期五

Raspberry Pi SD卡從8G變16G


從8G SD卡變成16G SD 卡, 要如何resize Partition


原本8G:

fdisk -h

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1        8192   137215   129024   63M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      137216 15564799 15427584  7.4G 83 Linux


首先,您需要使用fdisk更改分割表 要刪除現有的分區條目,然後創建一個新的分區吃滿整個可用空間。










Manually resizing the SD card on Raspberry Pi

You can also resize the partitions of the SD card that your Pi is running on.
First you need to change the partition table with fdisk. You need to remove the existing partition entries and then create a single new partition than takes the whole free space of the disk. This will only change the partition table, not the partitions data on disk. 


The start of the new partition needs to be aligned with the old partition!
Start fdisk:
sudo fdisk /dev/mmcblk0
Then delete partitions with d and create a new with n. You can view the existing table with p.
  • p to see the current start of the main partition
  • d3 to delete the swap partition
  • d2 to delete the main partition
  • n p 2 to create a new primary partition, next you need to enter the start of the old main partition and then the size (enter for complete SD card). The main partition on the Debian image from 2012-04-19 starts at 157696, but the start of your partition might be different. Check the p output!
  • w write the new partition table
Now you need to reboot:
 sudo shutdown -r now
After the reboot you need to resize the filesystem on the partition. The resize2fs command will resize your filesystem to the new size from the changed partition table.
sudo resize2fs /dev/mmcblk0p2
This will take a few minutes, depending on the size and speed of your SD card.
When it is done, you can check the new size with:
df -h

1 則留言 :

  1. Thanks for sharing, nice post!

    Tìm hiểu mua máy đưa võng http://mayduavong.me/dia-chi-mua-may-dua-vong-tu-dong-gia-re-uy-tin-tai-tp-hcm/ địa chỉ uy tín, giá rẻ tại TP.HCM hay nên mua loại máy đưa võng nào tốt với https://www.youtube.com/watch?v=l0oyXccR7ZE hay tìm hiểu sản phẩm cho trẻ em http://mayduavong.me/thuoc-pediakid-cua-phap-cho-tre-co-may-loai-co-tot-khong/ có mấy loại tốt cho trẻ không hay http://muahangamazon.net/my-pham-sebamed-cua-duc-cho-tre-loai-nao-tot-nhat-hien-nay.html mẹ có nên dùng cho con, sản phẩm http://treem.org/p/kem-chong-nang-cho-baby-sebamed-spf-50-cua-duc-co-tot-khong.html máy đưa võng TS http://mayduavong.ws/ có tốt cho trẻ không

    回覆刪除