现在的位置: 首页 > 综合 > 正文

Arch Linux raspberrypi 安装后扩展root分区

2018年05月18日 ⁄ 综合 ⁄ 共 4082字 ⁄ 字号 评论关闭

之前因为比较忙,导致树莓派一直在吃灰,同时,貌似官方推荐的Raspbian有点儿问题,配置文件一直保存不了,然后看着别人玩儿Arch好像很不错的样子就试玩了一把,其中装系统没啥说的,关键是分区,Arch Linux提供给树莓派的是img镜像,导致镜像多大,总共可用的空间就多大,这明显是不能接受的,所以搜索了一下,把分区搞定了,最近确实变懒了,直接上转载来的文章

转载地址为:http://blog.sina.com.cn/s/blog_578925940101gt5p.html  如有问题请及时联系我我随时撤销掉

Arch Linux 3.6.11-14-ARCH+ (ttyAMA0)
alarmpi login: root
鳳assword: 
Last login: Thu Jan  1 00:00:18 on ttyAMA0
[root@alarmpi ~]# ls
[root@alarmpi ~]# fdisk /dev/mmcblk0
Welcome to fdisk (util-linux 2.23.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p
Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes, 15564800 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
Disk label type: dos
Disk identifier: 0x00057540
        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048      186367       92160    c  W95 FAT32 (LBA)//这里是引导区,不变
/dev/mmcblk0p2          186368     3667967     1740800    5  Extended       //扩展分区需要重建
/dev/mmcblk0p5          188416     3667967     1739776   83  Linux          //逻辑分区需要重建
Command (m for help): d
Partition number (1,2,5, default 5): //直接回车,取默认 5,顺序要保证是先5,后2
Partition 5 is deleted
Command (m for help): p
Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes, 15564800 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
Disk label type: dos
Disk identifier: 0x00057540
        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048      186367       92160    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          186368     3667967     1740800    5  Extended
Command (m for help): d 
Partition number (1,2, default 2): //直接回车,取默认 2 
Partition 2 is deleted
Command (m for help): p
Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes, 15564800 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
Disk label type: dos
Disk identifier: 0x00057540
        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048      186367       92160    c  W95 FAT32 (LBA)
Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): e//建扩展分区
Partition number (2-4, default 2): 
First sector (186368-15564799, default 186368): 
Using default value 186368
Last sector, +sectors or +size{K,M,G} (186368-15564799, default 15564799): 
Using default value 15564799
Partition 2 of type Extended and of size 7.3 GiB is set
Command (m for help): p
Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes, 15564800 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
Disk label type: dos
Disk identifier: 0x00057540
        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048      186367       92160    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          186368    15564799     7689216    5  Extended
Command (m for help): n
Partition type:
   p   primary (1 primary, 1 extended, 2 free)
   l   logical (numbered from 5)
Select (default p): l//建逻辑分区
Adding logical partition 5
First sector (188416-15564799, default 188416): 
Using default value 188416
Last sector, +sectors or +size{K,M,G} (188416-15564799, default 15564799): 
Using default value 15564799
Partition 5 of type Linux and of size 7.3 GiB is set
Command (m for help): p
Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes, 15564800 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
Disk label type: dos
Disk identifier: 0x00057540
        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048      186367       92160    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          186368    15564799     7689216    5  Extended
/dev/mmcblk0p5          188416    15564799     7688192   83  Linux
Command (m for help): w
The partition table has been altered!
然后重启, 进入系统后执行
ln -s /dev/mmcblk0p5 /dev/root
resize2fs /dev/root
结果:
[root@alarmpi ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.3G  446M  6.5G   7% /
devtmpfs         83M     0   83M   0% /dev
tmpfs           231M     0  231M   0% /dev/shm
tmpfs           231M  248K  231M   1% /run
tmpfs           231M     0  231M   0% /sys/fs/cgroup
tmpfs           231M     0  231M   0% /tmp
/dev/mmcblk0p1   90M   24M   67M  27% /boot

抱歉!评论已关闭.