在使用Win32DiskImager为一张空白的SD卡刷入新的Rasbian系统后,卡上的可用剩余空间并不大,

本人有一张8G的SD卡,但是刷入4.1的Rasbian后,用df -h查看,根目录下的空间使用率居然是99%,而且总空间也就3.5G左右。

原因是因为Rasbian的image是为2G SD卡(这应该指的是Wheezy版本,Jessie版本应该是3.5G或者更多)准备的,如果想用剩余空间,就得重新分配分区。

来自官方的解释如下:

The prepared images for the Raspberry Pi are created for SD cards of the size of 2GB. The SD card can be resized or restructured to use the full size of a SD card that is greater than 2GB.

OK,下面就是具体方法(来自 elinux.org):

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

事实上老外也早早有遇到类似问题,在stackoverflow上问过:

How can I resize my / (root) partition?

可能有人不喜欢慢慢看英文,下面就来段中文的,摘录自网络

步骤1: 重新启动你的电脑,不要启动X windows

步骤2: $ sudo df -h
你应该会看到/ 挂载于rootfs(已使用97%左右)。 步骤3: $ sudo fdisk /dev/mmcblk0
命令:按P(印刷)
你应该会看到三个分区,现在把分区2的信息写下来(/dev/mmcblk0p2)。
命令:按d(删除分区2)
命令:按p(印刷)
现在应该会看到2个分区
命令:按n(加分区)
选择P (主要)
於分区2选择2
第一空格输入原来分区2的开始位置
最后的空格输入默认值
命令:按p(印刷)
你应该會看到分区2填满所有空间
命令:按w(保存) 步驟4: $sudo reboot
重新启动后,使用resize2fs来修复分区2 步驟5: $ sudo resize2fs /dev/mmcblk0p2
等待约2-3分钟 步驟6: $ sudo df -h
你应该會看到 / 挂载於rootfs(如果你使用8G SD卡,现在只会有22%的使用) 这样你便可以善用SD卡余下的空间了。

当然也有人根据elinux.org的建议,在ubuntu或者其它linux系统上使用gparted来对SD卡重新分配空间,可参考下面这篇博客,本文就不细述了。

树莓派Raspberry Pi 16G SD卡刷系统时默认空间扩容

Raspberry Pi - 调整你的SD卡分割区的大小的更多相关文章

  1. Android - 获取SD卡的内存空间大小

    获取SD卡的内存空间大小 //获得SD卡空间的信息 File path=Environment.getExternalStorageDirectory(); StatFs statFs=new Sta ...

  2. raspberry 烧写镜像到SD卡

    刚开始接触树莓派,需要烧写系统镜像到SD卡,网上找了些资料,记录于此. raspberry镜像下载: https://www.raspberrypi.org/downloads/ 烧写工具: wid3 ...

  3. Android(java)学习笔记183:判断SD卡状态和存储空间大小

    当我们在使用SD卡时候,如果我们想往SD卡里读写数据,我们必须在这之前进行一个逻辑判断,那就是判断SD卡状态和SD存储空间大小: 核心代码: String status = Environment.g ...

  4. Android获取SD卡总容量,可用大小,机身内存总容量及可用大小

    public long getSDTotalSize() { /*获取存储卡路径*/ File sdcardDir= Environment.getExternalStorageDirectory() ...

  5. 三大主流开源硬件对比:Arduino vs BeagleBone vs Raspberry Pi

    个人总结: Arduino就是个AVR单片机,个人觉得更适合玩电子的,社区也很活跃. BeagleBone是ARM Cortex-A8,属于嵌入式,价格高于Pi,但是许多方面拥有超越 Pi 的优 势, ...

  6. 如何在Raspberry Pi 3B中安装RASPBIAN

    RASPBIAN简介 RASPBIAN是树莓派官方支持的基于Debian的Linux系统.RASPBIAN预装了很多常用的组件,使用起来十分方便. 官方有RASPBIAN STRETCH WITH D ...

  7. 【树莓派】【转载】Raspberry Pi (树莓派)折腾记

    在网上看到一篇对树莓派折腾记录比较详细的文章,时间比较早,但是有些东西没变. 对于新手而言,还是有点参考价值.文章参见:http://skypegnu1.blog.51cto.com/8991766/ ...

  8. 不从SD卡启动树莓派2

    本文你可以学到: berryboot使用,kali安装,开挂的MobaXterm,以及关于通过LABEL和UUID挂载的小技巧. 本文默认你有一定Linux基础,同时针对刚入门的水平,因为这是我的折腾 ...

  9. Eclipse中查看Android模拟器SD卡目录

    · 有时候用到Android模拟器来模拟SD卡相关操作,在Eclipse中可以直接查看SD卡目录: 首先,新建模拟器的时候要创建SD卡,存储的大小根据需要创建: 启动模拟器,在Eclipse中打开视图 ...

随机推荐

  1. 用ksh运行一个helloworld

    本文目的在于记录和回顾.不建议当教程. Linux上没有ksh的话yum install ksh就可以了 直接上图 vim一个文件后缀名是ksh 内容是和shell差不多 然后赋予这个文件可执行权限 ...

  2. 持久层框架Clone

    Clone框架:http://www.52chloe.com/Wiki/Document/3324802610879266816 Clone框架支持多种数据库,我用的是sql server 基本查询: ...

  3. ActiveMQ学习笔记(17)----Message高级特性(一)

    1. Messaage Properties ActiveMQ支持很多消息属性,具体可以参考 http://activemq.apache.org/activemq-message-propertie ...

  4. JavaScript 中表达式和语句的区别

    1.语句和表达式 JavaScript中的表达式和语句是有区别的.一个表达式会产生一个值,它可以放在任何需要一个值的地方,比如,作为一个函数调用的参数.下面的每行代码都是一个表达式: myvar3 + ...

  5. vi 学习记录

    i 光标所在前插入 I 光标所在行的第一个非空字符前进入输入模式 a 光标所在后插入 A 光标所在最后插入 o 光标所在列下新增一列并进入输入模式 O 光标所在列上新增一列并进入输入模式 退出 :q, ...

  6. /etc/rsyncd.conf

    [root@backup ~]# cat /etc/rsyncd.conf #Rsync server#created by oldboy ##rsyncd.conf start##uid = rsy ...

  7. iOS AES的加密解密

    主要是要得到加密后的原来的字符创,MD5无法得到原有的,仅仅能用AES+base64 要用GTMBase64这个能够自己去下载, 主要看另外2个类文件. #import <Foundation/ ...

  8. MongoDB Shell (mongo)

    https://docs.mongodb.com/getting-started/shell/client/ The mongo shell is an interactive JavaScript ...

  9. 如何解读「量子计算应对大数据挑战:中国科大首次实现量子机器学习算法」?——是KNN算法吗?

    作者:知乎用户链接:https://www.zhihu.com/question/29187952/answer/48519630 我居然今天才看到这个问题,天……本专业,有幸听过他们这个实验的组会来 ...

  10. 5.IntellijIDEA常用快捷键总结

    转自:https://blog.csdn.net/qq_17586821/article/details/52554731下面的这些常用快捷键需要在实际操作中不断地体会才能真正感受到它们的方便之处. ...