Arch Linux raspberrypi 安裝後擴展root分區

之前因爲比較忙,導致樹莓派一直在吃灰,同時,貌似官方推薦的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


發佈了96 篇原創文章 · 獲贊 14 · 訪問量 75萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章