# IONOS



## Serveur Virtuel Cloud L

https://my.ionos.fr/account/subscriptions/72105527?linkId=ct.txt.contract-in-table



### Serveur (ubuntu 18.04):

https://cloudpanel.ionos.fr/panel/app/global?ionospanelid=ionos95fc7dab-6331-462d-9bbb-9dfdc47775ca8802#/servers/C5B08A8E443156B96BDD2EBCD47647B3

- Type : Serveur Cloud L 

- CPU : 2 vCore 

- RAM : 4 Go

- SSD : 120 Go



### Ajuster le volume logique après avoir agrandi le SSD dans Ubuntu/Debian (Serveur Cloud)

Vérifier l'espace disponible du volume logique:

```bash
root@localhost:~# df -h
Filesystem             Size  Used Avail Use% Mounted on
udev                   1,9G     0  1,9G   0% /dev
tmpfs                  393M  1,4M  391M   1% /run
/dev/mapper/vg00-lv01   47G   40G  5,5G  88% /
tmpfs                  2,0G     0  2,0G   0% /dev/shm
tmpfs                  5,0M   20K  5,0M   1% /run/lock
tmpfs                  2,0G     0  2,0G   0% /sys/fs/cgroup
/dev/sda1              464M  118M  318M  28% /boot
overlay                 47G   40G  5,5G  88% /var/lib/docker/overlay2/b84f17ce118f50b8d7db747e72cf46c1f906ef222de79b2a59f16462bf3b7a87/merged
overlay                 47G   40G  5,5G  88% /var/lib/docker/overlay2/ef5f892e92cfd2b421800225d7e12db74d4a4d17641f1f58c887e32941b3b9e1/merged
shm                     64M   16K   64M   1% /var/lib/docker/containers/2eeccf277a3d6ea64c9f263c6d568f465d121ba2b2e2cadcde7006d1c3e0bb41/mounts/shm
shm                     64M     0   64M   0% /var/lib/docker/containers/5ba6ae9f22b843a3e444fb38255f900152db1439255a73339aa83b254505cd29/mounts/shm
tmpfs                  393M     0  393M   0% /run/user/10001
tmpfs                  393M     0  393M   0% /run/user/0

```

Volume logique: /dev/mapper/vg00-lv01

```bash
root@localhost:~# fdisk -l
Disk /dev/sda: 120 GiB, 128849018880 bytes, 251658240 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: 0x41577866

Device     Boot  Start       End   Sectors  Size Id Type
/dev/sda1  *      2048    999423    997376  487M 83 Linux
/dev/sda2       999424 104857599 103858176 49,5G 8e Linux LVM


Disk /dev/mapper/vg00-lv00: 1,9 GiB, 2046820352 bytes, 3997696 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/mapper/vg00-lv01: 47,6 GiB, 51124371456 bytes, 99852288 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
```

Système de fichiers:

```bash
root@localhost:~# df -Th | grep "^/dev"
/dev/mapper/vg00-lv01 ext4       47G   40G  5,5G  88% /
/dev/sda1             ext4      464M  118M  318M  28% /boot
```

Agrandir la partition avec growpart:

```bash
root@localhost:~# growpart /dev/sda 2
CHANGED: partition=2 start=999424 old: size=103858176 end=104857600 new: size=250658783,end=251658207
```

Augmenter manuellement le volume logique:

```bash
root@localhost:~# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               vg00
  PV Size               49,52 GiB / not usable 3,00 MiB
  Allocatable           yes (but full)
  PE Size               4,00 MiB
  Total PE              12677
  Free PE               0
  Allocated PE          12677
  PV UUID               DMK49M-JflP-GBt9-0kJq-Kk1W-C7vO-x1nUZi
```

```bash
root@localhost:~# pvresize /dev/sda2
  Physical volume "/dev/sda2" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized

```

 Vérifier l'état des volumes logiques:

```bash
root@localhost:~# lvdisplay
  --- Logical volume ---
  LV Path                /dev/vg00/lv00
  LV Name                lv00
  VG Name                vg00
  LV UUID                loEucb-0VGb-seQj-3Vs0-5oCC-HUdt-0rJfcp
  LV Write Access        read/write
  LV Creation host, time somehost, 2019-08-29 20:27:48 +0200
  LV Status              available
  # open                 2
  LV Size                <1,91 GiB
  Current LE             488
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/vg00/lv01
  LV Name                lv01
  VG Name                vg00
  LV UUID                o6JDyc-lKL9-simp-fDTm-Yhix-2K1U-qiKvc3
  LV Write Access        read/write
  LV Creation host, time somehost, 2019-08-29 20:27:48 +0200
  LV Status              available
  # open                 1
  LV Size                47,61 GiB
  Current LE             12189
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

```

chemin du volume logique que vous voulez agrandir: /dev/vg00/lv01

Augmenter la taille du volume logique avec le programme lvresize:

```bash
root@localhost:~# lvresize -l +100%FREE /dev/vg00/lv01
  Size of logical volume vg00/lv01 changed from 47,61 GiB (12189 extents) to 117,61 GiB (30109 extents).
  Logical volume vg00/lv01 successfully resized.
```

Redimensionner le système de fichiers à la nouvelle taille à l'aide de resize2fs:

```bash
root@localhost:~# resize2fs /dev/vg00/lv01
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/vg00/lv01 is mounted on /; on-line resizing required
old_desc_blocks = 6, new_desc_blocks = 15
The filesystem on /dev/vg00/lv01 is now 30831616 (4k) blocks long.
```

 Vérifier si le système de fichiers a été ajusté:

```bash
root@localhost:~# df -h
Filesystem             Size  Used Avail Use% Mounted on
udev                   1,9G     0  1,9G   0% /dev
tmpfs                  393M  1,4M  391M   1% /run
/dev/mapper/vg00-lv01  116G   40G   72G  36% /
tmpfs                  2,0G     0  2,0G   0% /dev/shm
tmpfs                  5,0M   20K  5,0M   1% /run/lock
tmpfs                  2,0G     0  2,0G   0% /sys/fs/cgroup
/dev/sda1              464M  118M  318M  28% /boot
overlay                116G   40G   72G  36% /var/lib/docker/overlay2/b84f17ce118f50b8d7db747e72cf46c1f906ef222de79b2a59f16462bf3b7a87/merged
overlay                116G   40G   72G  36% /var/lib/docker/overlay2/ef5f892e92cfd2b421800225d7e12db74d4a4d17641f1f58c887e32941b3b9e1/merged
shm                     64M   16K   64M   1% /var/lib/docker/containers/2eeccf277a3d6ea64c9f263c6d568f465d121ba2b2e2cadcde7006d1c3e0bb41/mounts/shm
shm                     64M     0   64M   0% /var/lib/docker/containers/5ba6ae9f22b843a3e444fb38255f900152db1439255a73339aa83b254505cd29/mounts/shm
tmpfs                  393M     0  393M   0% /run/user/10001
tmpfs                  393M     0  393M   0% /run/user/0

```

https://www.ionos.fr/assistance/serveurs-et-cloud/administration-serveur/ajuster-le-volume-logique-apres-avoir-agrandi-le-ssd/ajuster-le-volume-logique-apres-avoir-agrandi-le-ssd-dans-ubuntudebian-serveur-cloud/?utm_source=search&utm_medium=global&utm_term=augmenter%20taille%20ssd&utm_campaign=BK_SHOP&utm_content=tariffselect



