Add new comment

Jak rozšířit kořenový oddíl v Arch Linuxu

Po instalaci Arch Linuxu na Raspberry Pi budete většinou potřebovat rozšířit velikost disku na maximální dostupnou velikost dle použité paměťové SD karty.

A jak to udělat Vám ukážeme zde:

1. Po přihlášení si vypište status filesystému:

[root@alarmpi ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.7G  444M  1.2G  28% /
devtmpfs         83M     0   83M   0% /dev
tmpfs           231M     0  231M   0% /dev/shm
tmpfs           231M  236K  231M   1% /run
tmpfs           231M     0  231M   0% /sys/fs/cgroup
tmpfs           231M     0  231M   0% /tmp
/dev/mmcblk0p1   90M   24M   67M  27% /boot

2. Použitím příkazu fdisk upravte filesystém /dev/mmcblk0:

[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):

3. Pokračujte smazáním druhého oddílu

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): 2
Partition 2 is deleted
 
Command (m for help):

4. Vytvořte nový oddíl a a logický svazek

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

Advertisement:

Do you need more power than RPi?

5. !! Zkontrolujte zda startovací oddíl začíná na stejném místě (start)

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

6. Jestli je vše v pořádku, uložte změny a proveďte reboot.

Command (m for help): w
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
 
WARNING: Re-reading the partition table failed with error 16: 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)
Syncing disks.
[root@alarmpi ~]# reboot

7. Po rebootu rozšiřte vybraný oddíl.

[root@alarmpi ~]# resize2fs /dev/mmcblk0p5
resize2fs 1.42.8 (20-Jun-2013)
Filesystem at /dev/mmcblk0p5 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mmcblk0p5 is now 1922048 blocks long.

8. Vypište si aktuální stav a hotovo. :-)

[root@alarmpi ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.3G  447M  6.5G   7% /
devtmpfs         83M     0   83M   0% /dev
tmpfs           231M     0  231M   0% /dev/shm
tmpfs           231M  236K  231M   1% /run
tmpfs           231M     0  231M   0% /sys/fs/cgroup
tmpfs           231M     0  231M   0% /tmp
/dev/mmcblk0p1   90M   24M   67M  27% /boot

V tomto příkladu byla použita 8GB SD karta.