在使用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. C#.Net版本自动更新程序及3种策略实现

    C#.Net版本自动更新程序及3种策略实现 C/S程序是基于客户端和服务器的,在客户机编译新版本后将文件发布在更新服务器上,然后建立一个XML文件,该文件列举最新程序文件的版本号及最后修改日期.如程序 ...

  2. select标签下option标签里value属性有什么用以及和text的区别

    转自:http://blog.csdn.net/summer_sy/article/details/54572398 1:value的用处 <select > <option val ...

  3. SQL SERVER 提取字符串中汉字

    IF OBJECT_ID('DBO.GET_ZNSTR') IS NOT NULLDROP FUNCTION DBO.GET_ZNSTRGOCREATE FUNCTION DBO.GET_ZNSTR( ...

  4. STM8S汇编代码分析

    转载:http://blog.csdn.net/u010093140/article/details/50021897使用STVD建立完汇编工程项目之后(具本建立方法可以看我的另一篇博文http:// ...

  5. shell-3.bash的基本功能:多命令顺序执行与管道符

    1. 2.

  6. 如何使easyui的datagrid 高度自适应

    如何使easyui的datagrid 高度自适应? 最开始使用easyui的datagrid加载数据时,对其设置的高度都是固定值,数据较多时table表现为滚动条形式.某天,老大突然需要datagri ...

  7. C#网络编程—HTTP应用编程(转)

    https://www.cnblogs.com/huangxincheng/archive/2012/01/09/2316745.html https://www.cnblogs.com/wangqi ...

  8. java上传文件工具类

    这个是之前整理之前所学时与使用java向邮箱发送邮件一块找到的,一起贴出来供大家参考: import java.awt.image.BufferedImage; import java.io.File ...

  9. 经典C语言编程注意点

    C/C++程序员应聘试题剖析 分中的2分.读者可从本文看到strcpy函数从2分到10分解答的例子,看看自己属于什么样的层次.此外,还有一些面试题考查面试者敏捷的思维能力. 分析这些面试题,本身包含很 ...

  10. libTIFF 图像读取与保存

    本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/YhL_Leo/article/details/49848391 1 头文件 libtif ...