LINUX.ORG.RU

qemu - увеличить размер Raspbian Buster

 ,


0

1

Я выполнил такие действия: Сконвертировал свежий образ Raspbian Buster в .qcow2 формат:

$ qemu-img convert -f raw -O qcow2 2021-05-07-raspios-buster-armhf-lite.img raspbian-buster-lite.qcow2

Потом скачал кастомизированное ядро Raspbian, которое работает с qemu:

$ wget https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/kernel-qemu-4.19.50-buster

и кастомизированный dtb файл:

$ wget https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/versatile-pb.dtb

Все это для того, чтобы запустить Raspberry версию Steamlink клиента на Arch ARM. Потом выполнил:

$ qemu-system-arm 
  -kernel ./kernel-qemu-4.19.50-buster 
  -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" 
  -hda raspbian-buster-lite.qcow2 
  -cpu arm1176 
  -m 512 
  -net nic 
  -net user,hostfwd=tcp::5022-:22 
  -serial stdio 
  -dtb ./versatile-pb.dtb 
  -machine versatilepb 
  -no-reboot

Raspbian Buster запустилась, я успешно залогинился, но после установки некоторых пакетов и зависимостей внутри Raspberry мало места - возникает ошибка при попытке первого запуска Steamlink:

pi@raspberrypi:~$ steamlink
Downloading update
http://media.steampowered.com/steamlink/rpi/steamlink-rpi3-1.1.80.197.tar.gz
gpg: keybox '/home/pi/.gnupg/pubring.kbx' created
gpg: /home/pi/.gnupg/trustdb.gpg: trustdb created
gpg: key 387C648A24C0E740: public key "Valve Steam Link Release Key <steamlink@steampowered.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1
Unpacking update
tar: steamlink/lib/libicudata.so.57: Wrote only 4608 of 10240 bytes
tar: steamlink/steamlink.sh: Cannot write: No space left on device
tar: steamlink/steamlinkdeps.txt: Cannot write: No space left on device
tar: steamlink/version.txt: Cannot write: No space left on device
tar: Exiting with failure status due to previous errors
Couldn't download Steam Link application, aborting
Press enter to continue: 

apt clean не сильно помог, т.к. на корне свободного места 85 MB.

Я так понимаю проблема в том, что сам .qcow2 образ весит около 1.5 GB:

-rw-r--r-- 1 gene users 1437663232 июл  8 15:42 raspbian-buster-lite.qcow2

Возможно ли ка-то или изначально увеличить место на Raspbian или позже?



Последнее исправление: xaizek (всего исправлений: 4)

Виртуалка увеличивается в 2 этапа:

  1. увеличивается файл на хосте

  2. в виртуалке делается ресайз партиции на увеличившемся диске и ресайз ФС. Если есть lvm в энутри виртуалки, то это делается даже без выключения, в онлайне: https://habr.com/ru/post/261755/

zemidius
()
Последнее исправление: zemidius (всего исправлений: 1)
Ответ на: комментарий от zorinquen

Ну ты конвернтул в qcow2, а размер не увеличил. Надо увеличить qemu-resize.

А как изнутри виртуалки увеличить диск - это второй вопрос уже.

zemidius
()
Ответ на: комментарий от zorinquen

В общем увеличил .qcow2 образ я удачно на 2 гига

% qemu-img resize raspbian-buster-lite.qcow2 +2G    
Image resized.
% qemu-img info raspbian-buster-lite.qcow2      
image: raspbian-buster-lite.qcow2
file format: qcow2
virtual size: 3.75 GiB (4022337536 bytes)
disk size: 1.34 GiB
cluster_size: 65536
Format specific information:
    compat: 1.1
    compression type: zlib
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
    extended l2: false

но при попытке увеличить образ внутри Raspbian Buster

root@raspberrypi:/home/pi# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.5G  1.4G   32M  98% /
devtmpfs        124M     0  124M   0% /dev
tmpfs           124M     0  124M   0% /dev/shm
tmpfs           124M  1.9M  122M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           124M     0  124M   0% /sys/fs/cgroup
/dev/sda1       253M   48M  205M  19% /boot
tmpfs            25M     0   25M   0% /run/user/1000

root@raspberrypi:/home/pi# fdisk -l
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram4: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram5: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram6: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram7: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram8: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram9: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram10: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram11: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram12: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram13: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram14: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram15: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sda: 3.8 GiB, 4022337536 bytes, 7856128 sectors
Disk model: QEMU HARDDISK   
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: 0x9730496b

Device     Boot  Start     End Sectors  Size Id Type
/dev/sda1         8192  532479  524288  256M  c W95 FAT32 (LBA)
/dev/sda2       532480 3661823 3129344  1.5G 83 Linux


Disk /dev/mtdblock0: 64 MiB, 67108864 bytes, 131072 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
root@raspberrypi:/home/pi# fdisk /dev/sda

Welcome to fdisk (util-linux 2.33.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/sda: 3.8 GiB, 4022337536 bytes, 7856128 sectors
Disk model: QEMU HARDDISK   
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: 0x9730496b

Device     Boot  Start     End Sectors  Size Id Type
/dev/sda1         8192  532479  524288  256M  c W95 FAT32 (LBA)
/dev/sda2       532480 3661823 3129344  1.5G 83 Linux

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): p
Partition number (2-4, default 2): 2
First sector (2048-7856127, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-8191, default 8191): +2G
Value out of range.
zorinquen
() автор топика
Ответ на: комментарий от zorinquen

Да, протупил. Сейчас всё получилось вот таким образом

root@raspberrypi:/home/pi# fdisk /dev/sda

Welcome to fdisk (util-linux 2.33.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/sda: 3.8 GiB, 4022337536 bytes, 7856128 sectors
Disk model: QEMU HARDDISK   
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: 0x9730496b

Device     Boot  Start     End Sectors  Size Id Type
/dev/sda1         8192  532479  524288  256M  c W95 FAT32 (LBA)
/dev/sda2       532480 3661823 3129344  1.5G 83 Linux

Command (m for help): d
Partition number (1,2, default 2): 2

Partition 2 has been deleted.

Command (m for help): p
Disk /dev/sda: 3.8 GiB, 4022337536 bytes, 7856128 sectors
Disk model: QEMU HARDDISK   
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: 0x9730496b

Device     Boot Start    End Sectors  Size Id Type
/dev/sda1        8192 532479  524288  256M  c W95 FAT32 (LBA)

Command (m for help): n
Partition type
   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-7856127, default 2048): 532480
Last sector, +/-sectors or +/-size{K,M,G,T,P} (532480-7856127, default 7856127): 

Created a new partition 2 of type 'Linux' and of size 3.5 GiB.
Partition #2 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: Y
The signature will be removed by a write command.

Command (m for help): w
The partition table has been altered.
Syncing disks.

Интересно что это за подпись «ext4 signature»? её безболезненно можно удалять?

zorinquen
() автор топика
Ответ на: комментарий от zorinquen

поспешил радоваться размер внутри не изменился:

root@raspberrypi:/home/pi# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.5G  1.2G  182M  87% /
devtmpfs        124M     0  124M   0% /dev
tmpfs           124M     0  124M   0% /dev/shm
tmpfs           124M  1.9M  122M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           124M     0  124M   0% /sys/fs/cgroup
/dev/sda1       253M   48M  205M  19% /boot
tmpfs            25M     0   25M   0% /run/user/1000

zorinquen
() автор топика
Ответ на: комментарий от zorinquen

хотя fdisk -l выдаёт:

Disk /dev/sda: 3.8 GiB, 4022337536 bytes, 7856128 sectors
Disk model: QEMU HARDDISK   
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: 0x9730496b

Device     Boot  Start     End Sectors  Size Id Type
/dev/sda1         8192  532479  524288  256M  c W95 FAT32 (LBA)
/dev/sda2       532480 7856127 7323648  3.5G 83 Linux


Disk /dev/mtdblock0: 64 MiB, 67108864 bytes, 131072 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 /dev/sda: 3.8 GiB, 4022337536 bytes, 7856128 sectors
Disk model: QEMU HARDDISK   
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: 0x9730496b

Device     Boot  Start     End Sectors  Size Id Type
/dev/sda1         8192  532479  524288  256M  c W95 FAT32 (LBA)
/dev/sda2       532480 7856127 7323648  3.5G 83 Linux


Disk /dev/mtdblock0: 64 MiB, 67108864 bytes, 131072 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

zorinquen
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.