[orangepizero]主分区磁盘扩容

最近用orangepi下载软件的时候提示没有可用足够空间,我才发现系统才自动分配了3g内存,还有10g没有分配到,于是我上网查了好多方法去扩容,又用了DG去调整,发现以下方法是扩容最简单的,又不会影响你原来的数据

***********************************************

WARNING: TO RESIZE FILESYSTEM RUN:

sudo fs_resize or sudo /usr/local/bin/fs_resize

to remove this message run:

sudo rm /usr/local/bin/fs_resize_warning

***********************************************

root@OrangePI:/home/orangepi# umount /dev/mmcblk0p2

umount: /: target is busy

        (In some cases useful info about processes that

         use the device is found by lsof(8) or fuser(1).)

root@OrangePI:/home/orangepi# fuser /dev/mmcblk0p2

root@OrangePI:/home/orangepi# umount /dev/mmcblk0p2

umount: /: target is busy

        (In some cases useful info about processes that

         use the device is found by lsof(8) or fuser(1).)

root@OrangePI:/home/orangepi# fdisk -l

Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 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: 0x0003c1e0

 

//记住起始点 此处为172032

Device         Boot  Start     End Sectors Size Id Type

/dev/mmcblk0p1       40960  172031  131072  64M  b W95 FAT32

/dev/mmcblk0p2      172032 6547455 6375424   3G 83 Linux

root@OrangePI:/home/orangepi# fdisk /dev/mmcblk0

 

 

Welcome to fdisk (util-linux 2.27.1).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

//删除原来的主分区

Command (m for help): d

Partition number (1,2, default 2): 2

 

Partition 2 has been deleted.

 

//创建新的主分区

Command (m for help): n

Partition type

   p   primary (1 primary, 0 extended, 3 free)

   e   extended (container for logical partitions)

Select (default p): 2

Value out of range.

   p   primary (1 primary, 0 extended, 3 free)

   e   extended (container for logical partitions)

Select (default p): p

Partition number (2-4, default 2): 2

First sector (2048-30253055, default 2048): 172032

Last sector, +sectors or +size{K,M,G,T,P} (172032-30253055, default 30253055): 30253055

 

Created a new partition 2 of type 'Linux' and of size 14.4 GiB.

 

//保存

Command (m for help): w

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).

 

 

root@OrangePI:/home/orangepi# sudo fs_resize

 

Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors

/dev/mmcblk0p1       40960   172031   131072   64M  b W95 FAT32

/dev/mmcblk0p2      172032 30253055 30081024 14.4G 83 Linux

 

  Max block: 30252032

   Part end: 30253055

 Part start: 172032

 

Partition allready maximum size !

 

//重启

root@OrangePI:/home/orangepi# reboot

 

Connection closed by foreign host.

 

Disconnected from remote host(新建会话 (2)) at 16:53:00.

 

Type `help' to learn how to use Xshell prompt.

[c:\~]$

 

Connecting to 192.168.184.136:22...

Connection established.

To escape to local shell, press 'Ctrl+Alt+]'.

 

Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 3.4.39 armv7l)

 

 * Documentation:  https://help.ubuntu.com

 * Management:     https://landscape.canonical.com

 * Support:        https://ubuntu.com/advantage

 

1 package can be updated.

1 update is a security update.

 

Last login: Fri Feb 12 00:28:17 2016 from 10.20.142.245

 

orangepi@OrangePI:~$ su

Password:

root@OrangePI:/home/orangepi# sudo fs_resize

 

Disk /dev/mmcblk0: 14.4 GiB, 15489564672 bytes, 30253056 sectors

/dev/mmcblk0p1       40960   172031   131072   64M  b W95 FAT32

/dev/mmcblk0p2      172032 30253055 30081024 14.4G 83 Linux

 

  Max block: 30252032

   Part end: 30253055

 Part start: 172032

 

Partition allready maximum size !

root@OrangePI:/home/orangepi# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/root       3.0G  2.4G  556M  82% /

devtmpfs        168M     0  168M   0% /dev

tmpfs           224M   72K  224M   1% /dev/shm

tmpfs           224M  3.6M  221M   2% /run

tmpfs           5.0M  4.0K  5.0M   1% /run/lock

tmpfs           224M     0  224M   0% /sys/fs/cgroup

tmpfs           224M  4.0K  224M   1% /tmp

/dev/mmcblk0p1   63M  4.6M   59M   8% /media/boot

tmpfs            45M     0   45M   0% /run/user/109

tmpfs            45M  8.0K   45M   1% /run/user/1000

 

// resize2fs:调整ext文件系统的空间大小

root@OrangePI:/home/orangepi# resize2fs -f /dev/mmcblk0p2

resize2fs 1.42.13 (17-May-2015)

Filesystem at /dev/mmcblk0p2 is mounted on /; on-line resizing required

old_desc_blocks = 1, new_desc_blocks = 1

The filesystem on /dev/mmcblk0p2 is now 3760128 (4k) blocks long.

 

//扩容成功

root@OrangePI:/home/orangepi# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/root        15G  2.4G   12G  18% /

devtmpfs        168M     0  168M   0% /dev

tmpfs           224M   72K  224M   1% /dev/shm

tmpfs           224M  3.6M  221M   2% /run

tmpfs           5.0M  4.0K  5.0M   1% /run/lock

tmpfs           224M     0  224M   0% /sys/fs/cgroup

tmpfs           224M  4.0K  224M   1% /tmp

/dev/mmcblk0p1   63M  4.6M   59M   8% /media/boot

tmpfs            45M  8.0K   45M   1% /run/user/1000

不出意外的话 就是扩容成功了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值