BBB expand sd card space

I use a 8G uSD with debian image of 4G, when I run mavproxy, it shows not enough space, since the whole system is at 3.3G some thing....

I checked the beaglebone web site about expanding sd card, this is not correct...
http://elinux.org/Beagleboard:Expanding_File_System_Partition_On_A_microSD

Another link does the job: http://dev.iachieved.it/iachievedit/expanding-your-beaglebone-microsd-filesystem/

BeagleBone_Black_1
There are a number of tutorials out there that show you how to expand a BeagleBone Black microSD-based filesystem. Most of them were written, however, when the delivered image from BeagleBoard.org contained two partitions: one a FAT partition, the other your standard Linux partition.
The aim of this post is to show you that indeed, you have nothing to fear expanding your BeagleBone Black partition even though there is only one (if you’re like us you get a little nervous when someone asks you to delete the partition you booted in).
Let’s get started. We’re using the Debian 8.3 LXQT 2016-01-24 4GB image from BeagleBoard.org. As you can see with df it’s a 4G (3.3G) filesystem, even though we just flashed it onto an 8GB microSD card:
debian@beaglebone:~$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p1  3.3G  2.8G  282M  91% /
The filesystem is on the mmcblk0 device, so we’ll use fdisk to repartition:
debian@beaglebone:~$ sudo fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Use the p command to print the current partition table. As expected, we see that the device itself has 8GB of space (well, 7.4), but our only partition is 3.3G.
Command (m for help): p
Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa2911fde

Device         Boot Start     End Sectors  Size Id Type
/dev/mmcblk0p1 *     2048 6963199 6961152  3.3G 83 Linux
Now, the “scary” part. Enter d to delete your partition.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Don’t worry, we’re adding it right back, with a size larger than the existing one. Enter n for New partition, and then p for primary partition.
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
At this point hit Enter at each prompt to accept the defaults.
Partition number (1-4, default 1): 
First sector (2048-15523839, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-15523839, default 15523839):

Created a new partition 1 of type 'Linux' and of size 7.4 GiB.
Use p once more to print out the partition table:
Command (m for help): p
Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa2911fde

Device         Boot Start      End  Sectors  Size Id Type
/dev/mmcblk0p1       2048 15523839 15521792  7.4G 83 Linux
Now press w (for write) and get another scary warning:
The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: 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).
Some tutorials would have you reboot here, but we’re going to run partprobe instead and then use resize2fs to resize our partition:
debian@beaglebone:~$ sudo partprobe
debian@beaglebone:~$ sudo resize2fs /dev/mmcblk0p1
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/mmcblk0p1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p1 is now 1940224 (4k) blocks long.
Editor’s Update: If you get to sudo partprobe only to find out that it isn’t installed, don’t panic! Just run sudo apt-get install parted and you’ll be on your way. Yes, this is after you’ve written you’re partition table and before you’ve resized your filesystem!
Use df -h / again and verify that you have reclaimed the unused space on your SD card.
debian@beaglebone:~$ df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p1  7.3G  2.8G  4.2G  40% /

留言

這個網誌中的熱門文章

Heltec ESP32+OLED+Lora, hardware testing

micro SD card for ESP32, on lolin32 with OLED and heltec 32 lora oled

Install Network Time Protocol(NTP) on BeagleBone with Angstrom linux and set local time zone