I want to resize в partition from датирует виртуальный machine without erasing any.
I only have access to this VM путь SSH, so I am not able to run в live СD.
The OS is Ubuntu 14.04.2 LTS.
My current partitions пахал:
Number Start End Size Type File system Flags
1 1049kB 256MB 255MB primary ext2 boot
2 257MB 10,7GB 10,5GB extended
5 257MB 10,7GB 10,5GB logical lvm
I have 10,7GB
unallocated. df -h
output:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/server--vg-root 7,6G 5,8G 1,4G 81% /
none 4,0K 0 4,0K 0% /sys/fs/cgroup
udev 2,0G 4,0K 2,0G 1% /dev
tmpfs 396M 516K 395M 1% /run
none 5,0M 0 5,0M 0% /run/lock
none 2,0G 0 2,0G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/sda1 236M 43M 181M 20% /boot
My /dev/sda
ты существуешь 21.5GB
and I am only using about 10GB
All the tutorials that гve found requires в live СD.
Any разрабатывает how хан I manage to do that?
Thanks
Не похоже, что Вы на самом деле имеете вакуум в наличии - "расширенный" раздел обычно покрывает все остающееся дисковое пространство. Возможно, что Вы делаете; особенно, если Вы создали образ диска на уровне 10 ГБ, и затем он был изменен к 20 ГБ.
Так, предполагая у Вас действительно есть вакуум, Вы должны:
fdisk
для этого fdisk
может разрушить Вашу таблицу разделов pvcreate /dev/sdaX
, где X новый раздел vgdisplay
литий> ул.> vgextend server-vg /dev/sdaX
литий> ул.> lvdisplay
литий> ул.> lvextend /dev/server-vg/root /dev/sdaX
литий> , ул.> resize2fs /dev/server-vg/root
литий> ул.> Ссылки:
http://litwol.com/content/fdisk-resizegrow-physical-partition-without-losing-data-linodecom
Я сделал это в VM с Сервером Ubuntu 18.04 и без LVM.
Начальное состояние после увеличения жесткий диск в VirtualBox.
ivanx@ivanx:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 1M 0 part
└─sda2 8:2 0 20G 0 part /
Следующий шаг должен удалить раздел и изменить размер с fdisk.
ivanx@ivanx:~$ sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.31.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
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 41940991 41936896 20G Linux filesystem
Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 has been deleted.
Command (m for help): p
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
Command (m for help): n
Partition number (2-128, default 2): 2
First sector (4096-83886046, default 4096): 4096
Last sector, +sectors or +size{K,M,G,T,P} (4096-83886046, default **83886046**):
Created a new partition 2 of type 'Linux filesystem' and of size 40 GiB.
Partition #2 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: N
Command (m for help): p
Device Start End Sectors Size Type
/dev/sda1 2048 4095 2048 1M BIOS boot
/dev/sda2 4096 83886046 83881951 40G Linux filesystem
Command (m for help): w
The partition table has been altered.
Syncing disks.
Результаты проверки:
ivanx@ivanx:~$ df -h
/dev/sda2 20G 19G 466M 98% /
ivanx@ivanx:~$ sudo resize2fs /dev/sda2
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 5
The filesystem on /dev/sda2 is now 10485243 (4k) blocks long.
ivanx@ivanx:~$ df -h
/dev/sda2 40G 19G 20G 49% /