Что имеем. последнее время hetzner прекратил делать автоматический resize диска после upgrade. в итоге делаем апгрейд но кроме ОЗУ ничего не меняется и пользуемся дисковым пространством с первоначального тарифа. Что делать в данном случае?
Я делал ресайз тарифа CX10-CX20
Через панель hetzner запускаем сервер в режиме Rescue
панель выдаст вам временный пароль
«Then you can access your server, using the user name «root» and the following password: RgThhx5FMCw2DS»
после полной загрузки Rescue подключаемся по ssh к серверу используя полученный логин и пароль
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ------------------------------------------------------------------- Welcome to the Hetzner Rescue System. This Rescue System is based on Debian 8.0 (jessie) with a newer kernel. You can install software as in a normal system. To install a new operating system from one of our prebuilt images, run 'installimage' and follow the instructions. More information at http://wiki.hetzner.de ------------------------------------------------------------------- Last login: Mon May 14 20:10:23 2018 Hardware data: CPU1: Intel Xeon Processor (Sandy Bridge) (Cores 2) Memory: 1942 MB Disk /dev/sda: 51 GB (=> 47 GiB) Total capacity 47 GiB with 1 Disk Network data: eth0 LINK: yes MAC: 52:54:a2:01:f1:77 IP: 172.31.1.100 IPv6: 2a01:4f8:c17:29c3::2/64 Virtio network driver |
проверьте текущую таблицу разделов
1 2 3 4 5 6 7 8 9 10 11 | root@rescue ~ # fdisk -l /dev/sda Disk /dev/sda: 47.7 GiB, 51204063232 bytes, 100007936 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: 0x000b7638 Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 49999871 49997824 23.9G 83 Linux |
Не будет лишним запомнить начальный и конечный сектор
Удаляем раздел и создаем новый на его месте
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | root@rescue ~ # fdisk /dev/sda Welcome to fdisk (util-linux 2.25.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): d Selected partition 1 Partition 1 has been deleted. Command (m for help): n Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p): p Partition number (1-4, default 1): First sector (2048-100007935, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-100007935, default 100007935): Created a new partition 1 of type 'Linux' and of size 47.7 GiB. Command (m for help): p Disk /dev/sda: 47.7 GiB, 51204063232 bytes, 100007936 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: 0x000b7638 Device Boot Start End Sectors Size Id Type /dev/sda1 2048 100007935 100005888 47.7G 83 Linux Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. |
Проверяем файловую систему
1 2 3 4 5 6 7 8 | root@rescue ~ # e2fsck -f -C0 /dev/sda1 e2fsck 1.42.12 (29-Aug-2014) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/sda1: 64237/1564672 files (0.8% non-contiguous), 1880876/6249728 blocks |
Изменяем размер
1 2 3 4 | root@rescue ~ # resize2fs /dev/sda1 resize2fs 1.42.12 (29-Aug-2014) Resizing the filesystem on /dev/sda1 to 12500736 (4k) blocks. The filesystem on /dev/sda1 is now 12500736 (4k) blocks long. |
и перезагружаемся
1 | root@rescue ~ # reboot |
Проверяю уже на запущенном сервере
1 2 3 4 5 6 7 8 | [root@mx ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 47G 6.8G 38G 16% / devtmpfs 911M 0 911M 0% /dev tmpfs 920M 0 920M 0% /dev/shm tmpfs 920M 8.4M 912M 1% /run tmpfs 920M 0 920M 0% /sys/fs/cgroup tmpfs 184M 0 184M 0% /run/user/0 |