В данной статьи описан один из способов, как изменить/расширить размер корневого (системного или root) раздела на ОС Linux Ubuntu, Lubuntu, Raspbian, Debian и т.п. для использования не распределённой памяти на Raspberry Pi, Orange Pi, Banana Pi и т.п..
ВНИМАНИЕ!!! Лучше всего это сделать на «свежую» ОС, чтобы, в случае чего, не потерять данные или сделать резервную копию MicroSD карты памяти — это можно сделать с помощью утилиты Win32 Disk Imager, нажимая на кнопку Read.
Вывод таблицы разделов
Для начала выводим список разделов с помощью fdisk
, определим устройство, соответствующее SD.
sudo fdisk -l
Получаем примерно такой результат:
root@OrangePI:~# sudo fdisk -l Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 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 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
В итоге мы имеем:
- Один диск (MicroSD накопитель) на 8 ГБ (
Disk /dev/mmcblk0: 7.4 GiB
); - И два раздела: один на 64 МБ (
/dev/mmcblk0p1 40960 172031 131072 64M b W95 FAT32
) и второй на 3 ГБ (/dev/mmcblk0p2 172032 6547455 6375424 3G 83 Linux
) — на этом разделе и установлена система.
Как изменить размер корневого раздела
Теперь переходим к расширению размера корневого раздела.
- Откроем инструмент разметки fdisk с устройством, соответствующим SD (mmcblk0):
sudo fdisk /dev/mmcblk0
результат:
root@OrangePI:~# sudo 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):
- Ещё раз выводим список разделов, вводим
p
:p
результат:
Command (m for help): p Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 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 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 Command (m for help):
Нам нужно сохранить сектор с которого партиция (раздел) начинается, в моём случае это 172032, он нам понадобится позже.
- Удаляем раздел, в котором находится файловая система (в этом случае есть только один, mmcblk0p1). Нажмите
d
, чтобы удалить раздел, потом введите2
, чтобы выбрать второй раздел:d
результат:
Command (m for help): d Partition number (1,2, default 2): 2 Partition 2 has been deleted. Command (m for help):
Раздел 2 был удален.
- Нажмите
n
, чтобы создать новый раздел:n
результат:
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
, чтобы выбрать основной тип раздела:p
результат:
Select (default p): p Partition number (2-4, default 2):
- Нажимаем «
ENTER
» или2
, чтобы принять 2 в качестве номера раздела по умолчанию:2
результат:
Partition number (2-4, default 2): 2 First sector (2048-15523839, default 2048):
- Вводим номер сектора с которого партиция (раздел) начинается, в моём случае — это 172032, номер о котором было написано выше (пункт второй):
ВНИМАНИЕ!!! Если промахнёмся тут — значит всё, мы больше не сможем запустить ОС и прийдётся переустановить её.
172032
результат:
First sector (2048-15523839, default 2048): 172032 Last sector, +sectors or +size{K,M,G,T,P} (172032-15523839, default 15523839):
- Теперь нужно вводить номер сектора которым заканчивается раздел, оставляем параметр по умолчанию, для этого нажимаем «ENTER», таким образом будет выбрано всё свободное пространство. Результат:
Last sector, +sectors or +size{K,M,G,T,P} (172032-15523839, default 15523839): Created a new partition 2 of type 'Linux' and of size 7.3 GiB. Command (m for help):
- Нажмите
w
, чтобы записать новую таблицу разделов:w
результат:
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:~#
Он предупредит, что изменение таблицы невозможно (система активна).
- Перезагрузите систему, чтобы заставить ядро распознать новую таблицу разделов.
sudo reboot
- Теперь нужно изменить размер раздела, содержащего файловую систему (mmcblk0p1), на новый размер (максимальный размер SD):
sudo resize2fs /dev/mmcblk0p2
результат:
root@OrangePI:~# sudo resize2fs /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 1918976 (4k) blocks long.
- Чтобы проверить, изменился ли размер корневого раздела, ещё раз выводим список разделов:
sudo fdisk -l
результат:
root@OrangePI:~# sudo fdisk -l Disk /dev/mmcblk0: 7.4 GiB, 7948206080 bytes, 15523840 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 Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 40960 172031 131072 64M b W95 FAT32 /dev/mmcblk0p2 172032 15523839 15351808 7.3G 83 Linux root@OrangePI:~#
Как мы видим теперь, размер корневого раздела почти 8 ГБ и мы можем использовать всю память.
Материалы
Banana Pi: resizing the SD card root partition on Lubuntu
Fdisk — wikipedia
Хорошая заметка, спасибо. Исследовал свою SD и обнаружил странное. По команде fdisk -l разглядел кроме 15 дисков /dev/ram1 … /dev/ram15. По 4 mb каждый. Предположительно — виртуальные диски !? Очень интересно. Среди смонтированных ( df) их нет.
Можете прокомментировать?
Автор сей статьи огромное СПАСИБО это очень нужная информация, я сделал в точности по тутор алу и всё ваышло, до этого находил инструкции и что-то не работало, чтото выдавало ошибку. Ещё раз спасибо большое!!!)
Спасибо за инструкцию. Менял на orange pi по ней.
Поправка:
>Чтобы проверить, изменился ли размер корневого раздела… …fdisk -l
fdisk итак покажет новый размер сразу после w и ребута.
Так что, после resize2fs (изменения размера ФС) смотреть df -h
/dev/mmcblk1p1 7.3G 1.3G 5.9G 18% /
Спасибо. Всё получилось.
после 8 пункта программа сообщила, что нашла сигнатуру ext4 и спросила удалить ли? (да/нет). Выбрал нет и продолжил дальше.
Trong lĩnh vực cá cược bóng đá, ty le keo nhà cai là một yếu tố quan trọng mà mọi người chơi cần phải hiểu rõ.
купить аккаунт с прокачкой услуги по продаже аккаунтов
перепродажа аккаунтов магазин аккаунтов социальных сетей
продать аккаунт https://kupit-akkaunt-top.ru/
купить аккаунт профиль с подписчиками
Account Buying Service Website for Buying Accounts
Account Trading Service Secure Account Purchasing Platform
Account Exchange Service accountsmarketplacehub.com
Account exchange Account Trading
Account Store Verified Accounts for Sale
Account Sale Account Selling Service
account trading account purchase
account purchase buy account
social media account marketplace guaranteed accounts
buy accounts sell accounts
account trading service social media account marketplace
account trading service https://socialaccountsshop.com
account trading account exchange
account trading secure account purchasing platform
account sale accounts for sale
account buying platform account exchange service
website for buying accounts account store
guaranteed accounts secure account sales
profitable account sales website for selling accounts
online account store account trading platform
account purchase accounts for sale
account purchase account sale
secure account purchasing platform account trading
account buying platform website for buying accounts
account market buy account
account sale sell accounts
account store https://accounts-offer.org/
accounts marketplace https://accounts-marketplace.xyz/
marketplace for ready-made accounts https://buy-best-accounts.org
account buying platform account marketplace
account market https://buy-accounts.live/
profitable account sales social-accounts-marketplace.live
маркетплейс аккаунтов akkaunty-na-prodazhu.pro
купить аккаунт маркетплейсов аккаунтов
маркетплейс аккаунтов https://akkaunt-magazin.online/
продажа аккаунтов akkaunty-market.live
площадка для продажи аккаунтов https://kupit-akkaunty-market.xyz/
покупка аккаунтов https://akkaunty-optom.live/
маркетплейс аккаунтов соцсетей https://online-akkaunty-magazin.xyz/
магазин аккаунтов akkaunty-dlya-prodazhi.pro
buy facebook accounts for ads https://buy-adsaccounts.work
buy facebook ads accounts https://ad-account-buy.top
buy account facebook ads buy a facebook ad account
google ads agency accounts https://buy-ads-account.top
buying fb accounts https://buy-accounts.click
buy google adwords account https://ads-account-for-sale.top
google ads reseller https://ads-account-buy.work
buy google adwords accounts buy google ad account
google ads accounts https://buy-account-ads.work
buy account google ads https://sell-ads-account.click
buy fb bm https://buy-business-manager.org/
old google ads account for sale https://buy-verified-ads-account.work
buy fb bm fb bussiness manager
buy business manager https://buy-business-manager-acc.org/
buy facebook bm https://buy-verified-business-manager-account.org/
buy facebook bm account https://business-manager-for-sale.org/
facebook bm buy buy verified bm facebook
buy facebook business manager account buy fb business manager
buy facebook business manager account https://buy-business-manager-accounts.org/
tiktok ad accounts tiktok ads account buy
tiktok ad accounts https://tiktok-agency-account-for-sale.org
buy tiktok ad account https://buy-tiktok-ad-account.org
tiktok ads account buy https://buy-tiktok-ads-accounts.org
tiktok ads agency account https://buy-tiktok-ads.org
http://eropharmfast.com/# best online ed medication
https://pharmau24.com/# Pharm Au24
https://pharmau24.com/# Online drugstore Australia
https://eropharmfast.shop/# Ero Pharm Fast
http://pharmau24.com/# Discount pharmacy Australia
http://eropharmfast.com/# ed treatments online
http://biotpharm.com/# Over the counter antibiotics pills
https://pharmsansordonnance.shop/# Pharmacie Internationale en ligne
http://viasansordonnance.com/# livraison rapide Viagra en France
http://pharmsansordonnance.com/# pharmacie en ligne france fiable
https://viasansordonnance.com/# Viagra sans ordonnance 24h
http://kampascher.com/# commander Kamagra en ligne
http://ciasansordonnance.com/# traitement ED discret en ligne
https://kampascher.com/# Kamagra oral jelly pas cher
https://viasansordonnance.com/# viagra en ligne
https://pharmsansordonnance.shop/# Pharmacie en ligne livraison Europe
https://pharmsansordonnance.com/# pharmacie en ligne sans ordonnance
https://viasansordonnance.com/# viagra sans ordonnance
https://pharmsansordonnance.shop/# pharmacie en ligne avec ordonnance
https://ciasansordonnance.com/# acheter Cialis sans ordonnance
https://viasansordonnance.com/# Viagra pas cher livraison rapide france
https://kampascher.shop/# commander Kamagra en ligne
https://viasansordonnance.shop/# Viagra prix pharmacie paris
https://farmaciasubito.com/# tachidol 1000
https://pharmacieexpress.shop/# acheter tadalafil en ligne
https://farmaciasubito.com/# farmacia sicura online
https://pharmacieexpress.shop/# mГ©dicament contre cystite sans ordonnance
http://pharmacieexpress.com/# peut on avoir des medicaments sans ordonnance dans une pharmacie de garde
https://confiapharma.com/# farmacia online acido hialuronico inyectable
http://pharmacieexpress.com/# zolpidem prix pharmacie sans ordonnance
https://pharmacieexpress.com/# achat tadalafil 10 mg
https://farmaciasubito.com/# olpress 10 mg
https://pharmacieexpress.com/# cystite traitement pharmacie sans ordonnance
https://confiapharma.shop/# se pueden comprar probioticos sin receta
http://pharmexpress24.com/# canadia online pharmacy
https://inpharm24.shop/# online india pharmacy reviews
https://inpharm24.shop/# online pharmacy india ship to usa
https://inpharm24.shop/# buy medicine from india
https://pharmmex.shop/# ozempic overseas pharmacy
https://inpharm24.com/# pharmacy india
https://pharmmex.com/# ozempic otc mexico
http://inpharm24.com/# dandruff shampoo india pharmacy
https://vgrsources.com/# cheap genuine viagra online
https://vgrsources.com/# viagra 100 mg price in india
https://vgrsources.com/# generic viagra where to buy
https://vgrsources.com/# best otc female viagra
https://vgrsources.com/# where to buy women viagra
https://vgrsources.com/# viagra 100 mg tablet price in india
https://vgrsources.com/# super viagra
https://vgrsources.com/# generic viagra cost in canada
https://prednipharm.com/# buy prednisone 1 mg mexico
http://crestorpharm.com/# Best price for Crestor online USA
http://lipipharm.com/# Lipi Pharm
https://semaglupharm.com/# No prescription diabetes meds online
https://lipipharm.com/# Order cholesterol medication online
https://prednipharm.com/# can i buy prednisone from canada without a script
http://crestorpharm.com/# rosuvastatin capsules
https://semaglupharm.com/# Semaglu Pharm
http://lipipharm.com/# LipiPharm
http://crestorpharm.com/# CrestorPharm
https://crestorpharm.com/# CrestorPharm
https://crestorpharm.com/# crestor pill image
https://crestorpharm.shop/# Over-the-counter Crestor USA
https://lipipharm.shop/# can lipitor cause vertigo
http://semaglupharm.com/# SemagluPharm
https://semaglupharm.shop/# SemagluPharm
https://prednipharm.com/# brand prednisone
https://prednipharm.com/# PredniPharm
https://lipipharm.shop/# Cheap Lipitor 10mg / 20mg / 40mg
Affordable cholesterol-lowering pills Crestor Pharm Crestor Pharm
Crestor Pharm: Crestor Pharm — Crestor home delivery USA
apo prednisone: prednisone 5mg coupon — 3000mg prednisone