Disks

Create swapfile

Make a disk compressed image using dd

1
sudo bash -c "dd if=/dev/sdx | gzip > /tmp/backup.gz"

smartcl

Increase disk space in VM


title: Increase VM Hard disk space
categories:

  • infrastructure
  • servers
    tags:
  • infrastructure
  • servers
  • labs.cirici.com
    date: 2017-06-2 23:23:23

How to increase VMs hard disk space

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
root@docker01:~# fdisk -l

Disk /dev/vda: 10 GiB, 10737418240 bytes, 20971520 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: 0xdbb6da04

Device Boot Start End Sectors Size Id Type
/dev/vda1 2048 20971519 20969472 10G 83 Linux

root@docker01:~# fdisk -l

Disk /dev/vda: 11 GiB, 11811160064 bytes, 23068672 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: 0xdbb6da04

Device Boot Start End Sectors Size Id Type
/dev/vda1 2048 20971519 20969472 10G 83 Linux

root@docker01:~# fdisk /dev/vda

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

Using default response p.
Partition number (1-4, default 1):
First sector (2048-23068671, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-23068671, default 23068671):

Created a new partition 1 of type 'Linux' and of size 11 GiB.

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@docker01:~# partprobe
root@docker01:~# resize2fs /dev/vda1
resize2fs 1.42.12 (29-Aug-2014)
El sistema de fitxers a /dev/vda1 està muntat a /; cal un canvi de mida en línia
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/vda1 is now 2883328 (4k) blocks long.

root@docker01:~#

Old way

The first step you must do is go to Proxmox panel, then follow this steps:

  • Select the VM you need to increase its space.
  • Select the hardware tab and select the Hard disk.
  • Click on top button “Resize disk”.
  • Set how much space you want to add (the amount you specify will be added to the initial value).
  • (IF the VM disk device is != VirtIO) Shutdown and start again the VM. (No restart)
  • Enter to the VM using SSH.
  • run fdisk -l and check the actual size
  • then fdisk /dev/vda -> press d select partition 1 and delete it -> press n and create new partition, by default will take all the space allocable.
  • then partprobe
  • Finally expand the filesystem size running resize2fs /dev/vda1
References

(Deprecated) https://pve.proxmox.com/wiki/Resize_disks

Comments

⬆︎TOP