在使用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. 关于hexo markdown添加的图片在github page中无法显示的问题

    title: 关于hexo markdown添加的图片在github page中无法显示的问题 date: 2018-03-31 00:21:18 categories: methods tags: ...

  2. jqGrid冻结列

    jqgrid冻结列 冻结列:就是横向移动表格时,让某一列保持不动 做法: 1.colModel的行要加上属性: frozen:true.注意:冻结列必须从第一列开始,包括隐藏列 2.加载jqgrid后 ...

  3. 报表工具Report Builder 3.0的安装

    工作后第一次尝试独立安装一个软件啊 话不多说,总结一下过程 前言:已经Baidu了Report Builder 3.0的安装教程了,就到微软的官网上下载去了,下载完成双击程序安装告诉我,要想安装Rep ...

  4. JS循环 for while 全局/局部变量 短路

    循环语句: For for循环的格式 for(var i = 0; i < 10; i ++){ } for循环的执行顺序: ①   ② 若判断为 true  进④  进③ 进②判断 ……循环 ...

  5. MySQL学习(五)——使用JDBC完成用户表CRUD的操作

    通过案例我们发现“获得连接”和“释放资源”两次代码将在之后的增删改查所有功能中都存在,开发中遇到此种情况,将采用工具类的方法进行抽取,从而达到代码的重复利用. 1.使用properties配置文件 开 ...

  6. jquery根据接口返回的值来设置asp:CheckBoxList的选中值

    接口返回一个json的值,然后通过jquery来选中asp:CheckBoxList相应选中的值 <asp:CheckBoxList runat="server" Repea ...

  7. oc语言的特点

    oc语言的特点分为以下几个方面: 1.运行时: 2.block闭包: 3.内存管理: 4.大中枢派发: 一.运行时的基础是isa 类结构:由clang编译前端支撑. 从它衍生出以下几个特征: 1.消息 ...

  8. Swift 中的协议

    Swift 中的协议协议是为方法.属性等定义一套规范,没有具体的实现,类似于Java中的抽象接口,它只是描述了方法或属性的骨架,而不是实现.方法和属性实现还需要通过定义类,函数和枚举完成. 协议定义 ...

  9. OSI概述问答

    1.    网络中体系结构的七层.四层.五层是怎么回事? OSI(Open System Interconnection)开放系统互连参考模型的七层协议体系结构:概念清楚,理论比较完整,但既复杂又不用 ...

  10. VUEJS开发规范

    VUEJS开发规范 基于组件化开发理解 组件命名规范 结构化规范 注释规范 编码规范 基于组件化开发理解 什么是组件? ``` 组件其实就是页面组成的一部分,好比是电脑中的每一个元件(如硬盘.键盘.鼠 ...