Ubuntu - tabela de partições desordenada

0

Eu tenho um servidor ubuntu 14.04 vm em um servidor Xen. Eu tenho 40 GB de espaço em disco alocado para ele e minha tabela de partição se parece com isso

df -h
Filesystem                               Size  Used Avail Use% Mounted on
udev                                      16G  4.0K   16G   1% /dev
tmpfs                                    3.1G  712K  3.1G   1% /run
/dev/mapper/QAAutomationServer--vg-root  8.3G  7.1G  797M  91% /
none                                     4.0K     0  4.0K   0% /sys/fs/cgroup
none                                     5.0M     0  5.0M   0% /run/lock
none                                      16G     0   16G   0% /run/shm
none                                     100M     0  100M   0% /run/user
/dev/xvda1                               236M   68M  156M  31% /boot

se você olhar mais de perto, verá que minha partição raiz tem cerca de 8gb alocada a ela e está quase cheia. / run / shm tem 16gb e / dev tem outros 16gb que mal são usados.

Eu tentei procurar no google para descobrir se posso corrigir esse problema, mas todas as soluções que encontrar sugerem inicializar usando o live cd e usar o gparted para gerenciar as partições. Mas estando em uma vm em Xen, não posso fazer isso.

Alguém por favor pode me ajudar a corrigir esse problema?

Obrigado Kiran

Editar

saída de sudo parted -l

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/QAAutomationServer--vg-root: 9135MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system  Flags
 1      0.00B  9135MB  9135MB  ext4


Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/QAAutomationServer--vg-swap_1: 33.6GB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End     Size    File system     Flags
 1      0.00B  33.6GB  33.6GB  linux-swap(v1)


Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system  Flags
 1      1049kB  256MB   255MB   primary   ext2
 2      257MB   42.9GB  42.7GB  extended
 5      257MB   42.9GB  42.7GB  logical                lvm

Edit2

Eu fiz algumas pesquisas sobre lvm e aprendi que posso redimensionar as partições lógicas usando lvextend e lvreduce .

aqui está a saída de lvdisplay

lvdisplay
  --- Logical volume ---
  LV Path                /dev/QAAutomationServer-vg/root
  LV Name                root
  VG Name                QAAutomationServer-vg
  LV UUID                ZRnyaa-fDlK-ulAH-2rcv-Haga-lxuU-TB0kqb
  LV Write Access        read/write
  LV Creation host, time QAAutomationServer, 2015-09-04 11:57:16 -0700
  LV Status              available
  # open                 1
  LV Size                8.51 GiB
  Current LE             2178
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/QAAutomationServer-vg/swap_1
  LV Name                swap_1
  VG Name                QAAutomationServer-vg
  LV UUID                QTPf2n-y8CA-FZDL-3xLH-33BX-mZIv-Zx1Jyu
  LV Write Access        read/write
  LV Creation host, time QAAutomationServer, 2015-09-04 11:57:17 -0700
  LV Status              available
  # open                 0
  LV Size                31.25 GiB
  Current LE             8000
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

Então, estou tentando lvreduce -L -5g /xyz na aprtition de swap e, em seguida, lvextend -L +5g /abc na partição raiz.

e, uma vez feito isso, estou fazendo um sudo resize2fs /def na partição raiz

Não sei se isso garantirá a perda de dados, mas vejo que agora tenho espaço adicional na partição raiz.

df -h
Filesystem                               Size  Used Avail Use% Mounted on
udev                                      16G  4.0K   16G   1% /dev
tmpfs                                    3.1G  712K  3.1G   1% /run
/dev/mapper/QAAutomationServer--vg-root   14G  7.1G  5.6G  57% /
none                                     4.0K     0  4.0K   0% /sys/fs/cgroup
none                                     5.0M     0  5.0M   0% /run/lock
none                                      16G     0   16G   0% /run/shm
none                                     100M     0  100M   0% /run/user
/dev/xvda1                               236M   68M  156M  31% /boot
    
por Kiran Vemuri 18.01.2016 / 20:23

2 respostas

0

O que você mostrou no topo da sua anotação não é sua tabela de partições. É uma lista dos seus sistemas montados.
/ run / shm e / dev não são sistemas de arquivos 'reais'. Que são sistemas de arquivos virtuais localizados na RAM do seu computador. Eles não usam seu espaço em disco.
O que é realmente interessante é:

Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 42.9GB
[...]
Number  Start   End     Size    Type      File system  Flags
 1      1049kB  256MB   255MB   primary   ext2
 2      257MB   42.9GB  42.7GB  extended
 5      257MB   42.9GB  42.7GB  logical                lvm

Seu dispositivo de disco virtual (~ 42GB de tamanho) é dividido em duas partições primárias: 1: boot (anúncio montado / boot) 2. estendido Na sua partição estendida, você tem uma partição para lvm. LVM significa Linux Volume Manager. Ele cria um dispositivo de bloco virtual, que você pode usar como dispositivo de bloqueio regular, mas amplia ou encolhe "on the fly" e o constrói com vários volumes físicos, o que é muito útil em algumas situações.

Nesse dispositivo virtual, você tem duas partições virtuais:
Primeiro:

/dev/mapper/QAAutomationServer--vg-root: 9135MB

, que é montado como sua partição raiz, e segundo:

/dev/mapper/QAAutomationServer--vg-swap_1: 33.6GB

qual é o seu swap.

Como você pode ver, o swap consome mais de 3/4 de sua unidade inteira.

Então meu conselho é: 1. Desligue o swap 2. Excluir / encolher partição swap 3. Expandir partição raiz 4. Redimensione rootfs (isso pode ser feito provavelmente no sistema de arquivos 'live') 5. Crie uma partição swap usando o espaço restante 6. Ligue o swap

Aqui você encontrará como lidar com os volumes LVM: link

    
por nsilent22 18.01.2016 / 21:03
0

Como fiz minha configuração inicial usando lvm , consegui usar o lvm para redimensionar meus volumes lógicos e redimensionar a partição raiz.

link

lvdisplay - lista todas as partições lvm disponíveis

lvreduce -L -5g /lvmpartition - reduz a taxa de transmissão selecionada em 5G

lvextend -L +5g /lvmpartition - estende a lvmpartição selecionada por 5G

Como eu tinha cerca de 30G alocados para trocar, consegui reduzi-lo para 10G e estender a partição raiz-lvm com o espaço livre de 20G resultante.

Aqui está a saída de lvdisplay após as modificações

  LV Path                /dev/QAAutomationServer-vg/root
  LV Name                root
  VG Name                QAAutomationServer-vg
  LV UUID                ZRnyaa-fDlK-ulAH-2rcv-Haga-lxuU-TB0kqb
  LV Write Access        read/write
  LV Creation host, time QAAutomationServer, 2015-09-04 11:57:16 -0700
  LV Status              available
  # open                 1
  LV Size                30.51 GiB
  Current LE             7810
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:0

  --- Logical volume ---
  LV Path                /dev/QAAutomationServer-vg/swap_1
  LV Name                swap_1
  VG Name                QAAutomationServer-vg
  LV UUID                QTPf2n-y8CA-FZDL-3xLH-33BX-mZIv-Zx1Jyu
  LV Write Access        read/write
  LV Creation host, time QAAutomationServer, 2015-09-04 11:57:17 -0700
  LV Status              available
  # open                 0
  LV Size                9.25 GiB
  Current LE             2368
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           252:1

agora eu fiz sudo resize2fs na partição raiz e aqui está a saída de df -h

df -h
Filesystem                               Size  Used Avail Use% Mounted on
udev                                      16G  4.0K   16G   1% /dev
tmpfs                                    3.1G  712K  3.1G   1% /run
/dev/mapper/QAAutomationServer--vg-root   30G  7.1G   22G  25% /
none                                     4.0K     0  4.0K   0% /sys/fs/cgroup
none                                     5.0M     0  5.0M   0% /run/lock
none                                      16G  4.0K   16G   1% /run/shm
none                                     100M     0  100M   0% /run/user
/dev/xvda1                               236M   68M  156M  31% /boot

Isso aumentou o espaço na minha partição raiz. Espero que esta resposta ajude alguém com problemas semelhantes.

    
por Kiran Vemuri 18.01.2016 / 21:20