Lvm write error failed no space left on device

Добрый день. Пытаюсь рашсирить LVM, но не выходит. Статьи про разбор и настройку читал, но никак не могу понять в чём проблема. Есть сервер с одним диском, диск размечен как sda 40G ├─sda1...

Добрый день. Пытаюсь рашсирить LVM, но не выходит. Статьи про разбор и настройку читал, но никак не могу понять в чём проблема.

Есть сервер с одним диском, диск размечен как

sda                                     40G                   
├─sda1                                   1M                   
├─sda2                    ext4           1G /boot             
└─sda3                    LVM2_member   39G                   
  └─ubuntu--vg-ubuntu--lv ext4          20G /    

Изначально размер диска был 20ГБ. Затем я добавил ещё 10 и потом ещё 10 ГБ. После этого я через parted расширил раздел /sda/sda3 до 40ГБ.

parted 

(parted) p                                                                
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 42.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  2097kB  1049kB                     bios_grub
 2      2097kB  1076MB  1074MB  ext4
 3      1076MB  42.9GB  41.9GB

fdisk -l тоже показывает что всё в порядке

Disk /dev/sda: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: Virtual disk    
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: gpt
Disk identifier: BC7CFF26-5C03-4E81-96AD-24F64C95FF13

Device       Start      End  Sectors Size Type
/dev/sda1     2048     4095     2048   1M BIOS boot
/dev/sda2     4096  2101247  2097152   1G Linux filesystem
/dev/sda3  2101248 83886046 81784799  39G Linux filesystem


Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 20 GiB, 21474836480 bytes, 41943040 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

Теперь, если я правильно всё понял, мне нужно увеличить pv, затем vg и наконец lv.

Текущее состояние у них такое. PV:

pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               ubuntu-vg
  PV Size               <29.00 GiB / not usable 0   
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              7423
  Free PE               2303
  Allocated PE          5120
  PV UUID               BtcE1F-wgZj-f7SB-l8d7-wYdN-5P0n-epVcgu
 
VG:
vgdisplay
  --- Volume group ---
  VG Name               ubuntu-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <29.00 GiB
  PE Size               4.00 MiB
  Total PE              7423
  Alloc PE / Size       5120 / 20.00 GiB
  Free  PE / Size       2303 / <9.00 GiB
  VG UUID               Uky340-xdnN-zlJN-3Y1p-vgMz-gDKa-LUpKOQ
LV:
lvdisplay
  --- Logical volume ---
  LV Path                /dev/ubuntu-vg/ubuntu-lv
  LV Name                ubuntu-lv
  VG Name                ubuntu-vg
  LV UUID                b82Hpt-Mjcf-OpJK-NBpC-e5Mf-yeQo-jm6HpC
  LV Write Access        read/write
  LV Creation host, time ubuntu-server, 2021-05-20 10:57:25 +0000
  LV Status              available
  # open                 1
  LV Size                20.00 GiB
  Current LE             5120
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
 

pvscan показывает что есть 9GB Free

  PV /dev/sda3   VG ubuntu-vg       lvm2 [<29.00 GiB / <9.00 GiB free]
  Total: 1 [<29.00 GiB] / in use: 1 [<29.00 GiB] / in no VG: 0 [0   ]
 

Но pvresize /dev/sda3 не хочет ничего расширять:

  /etc/lvm/archive/.lvm_gitlab_2339193_255526967: write error failed: No space left on device
  0 physical volume(s) resized or updated / 1 physical volume(s) not resized

Подскажите пожалуйста, что я делаю не так?

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • New to Ubuntu
  • lvextend «write error failed: No space left on device»

  1. lvextend «write error failed: No space left on device»

    My root directory has run out of space. I have been trying to extend the space available to my root volume.

    lvdisplay output:

    Code:

    pciadmin@phabricator2:~$ sudo lvdisplay
      --- Logical volume ---
      LV Path                /dev/phabricator2-vg/root
      LV Name                root
      VG Name                phabricator2-vg
      LV UUID                fcl37J-r6yY-qmxP-8Sxa-lOgi-bduJ-vyze44
      LV Write Access        read/write
      LV Creation host, time phabricator2, 2019-01-23 12:59:28 -0700
      LV Status              available
      # open                 1
      LV Size                5.16 GiB
      Current LE             1320
      Segments               2
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           252:0
    
    
      --- Logical volume ---
      LV Path                /dev/phabricator2-vg/swap_1
      LV Name                swap_1
      VG Name                phabricator2-vg
      LV UUID                GNK5cA-qbcy-jSr8-vk4t-wVZ7-HPmF-gD9mYG
      LV Write Access        read/write
      LV Creation host, time phabricator2, 2019-01-23 12:59:28 -0700
      LV Status              available
      # open                 2
      LV Size                4.36 GiB
      Current LE             1117
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           252:1

    df output:

    Code:

    pciadmin@phabricator2:~$ sudo df
    Filesystem                        1K-blocks    Used Available Use% Mounted on
    udev                                2127356       0   2127356   0% /dev
    tmpfs                                429480    6108    423372   2% /run
    /dev/mapper/phabricator2--vg-root   5166504 5150120         0 100% /
    tmpfs                               2147392       0   2147392   0% /dev/shm
    tmpfs                                  5120       0      5120   0% /run/lock
    tmpfs                               2147392       0   2147392   0% /sys/fs/cgroup
    /dev/xvda1                           482922   58225    399763  13% /boot
    tmpfs                                429584       0    429584   0% /run/user/1000

    pvdisplay output:

    Code:

    pciadmin@phabricator2:~$ sudo pvdisplay
      --- Physical volume ---
      PV Name               /dev/xvda5
      VG Name               phabricator2-vg
      PV Size               9.52 GiB / not usable 2.00 MiB
      Allocatable           yes (but full)
      PE Size               4.00 MiB
      Total PE              2437
      Free PE               0
      Allocated PE          2437
      PV UUID               zT75Qa-ZU2C-uEes-WhCS-aEe3-joyw-PGKexG
    
    
      --- Physical volume ---
      PV Name               /dev/xvda3
      VG Name               phabricator2-vg
      PV Size               9.06 GiB / not usable 1.34 MiB
      Allocatable           yes
      PE Size               4.00 MiB
      Total PE              2319
      Free PE               2319
      Allocated PE          0
      PV UUID               dDHJtE-agLF-tcAo-kCrG-07ji-Dl8e-XNMgYd

    vgdisplay output:

    Code:

    pciadmin@phabricator2:~$ sudo vgdisplay
      --- Volume group ---
      VG Name               phabricator2-vg
      System ID
      Format                lvm2
      Metadata Areas        2
      Metadata Sequence No  5
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                2
      Open LV               2
      Max PV                0
      Cur PV                2
      Act PV                2
      VG Size               18.58 GiB
      PE Size               4.00 MiB
      Total PE              4756
      Alloc PE / Size       2437 / 9.52 GiB
      Free  PE / Size       2319 / 9.06 GiB
      VG UUID               jiyC26-q1Q4-huAX-l7iM-UIEE-3Jcv-E0CiLg

    When I try to run lvextend on root, I get the following error:

    Code:

    pciadmin@phabricator2:~$ sudo lvextend -L+8G /dev/phabricator2-vg/root
      /etc/lvm/archive/.lvm_phabricator2_2193_124559942: write error failed: No space left on device
      Volume group "phabricator2-vg" metadata archive failed.

    I’m not sure what I’m missing.


  2. Re: lvextend «write error failed: No space left on device»

    Delete or move some files from root to make room to write additions to /etc/lvm/archive

    Then, when extending the lv, you have to resize the filesystem too. Try:

    Code:

     sudo lvextend --resizefs --extents= +2000 /dev/phabricator2-vg/root

    This adds 2000 of the 2319 free extents, which is about 8 GB, and resizes the file system at the same time.


Tags for this Thread

Bookmarks

Bookmarks


Posting Permissions

I have given my VM an extra 50GB, and expanded the partition with gparted. 

When trying to get LVM to use the extra space with lvextend, I get an error: logical volume contains a filesystem in use. 

I’ve tried lvdisplay and vgdisplay to see if I need to use a different LV path, but no luck. 

This is Ubuntu 18.04.03 LTS

check
Best Answer

  • Has your root partition completely filled up 100%? The resize is failing because there’s probably not even a byte free space in the root filesystem to backup and write metadata.

    You can try adding «-A n» to lvresize to turn off auto-backup of metadata (see man page for details and cautions) which should prevent having to write to /etc/lvm You can then run vgcfgbackup after you have been successful in resizing.

    Alternatively, if you are fully out of space you could try to remove a few files. LVM doesn’t require much space for its backup. A few doze KB at most (typically speaking).

    A few easy and safe things to remove, assuming everything is in a single partition and you don’t have /var and such separated:

    • APT cache: rm -rf /var/cache/apt (it’ll regenerate next time you run apt)
    • Logs from /var/log
    • Contents of /tmp and /var/tmp (but you may cause issues on a running system if you remove the wrong stuff so take some care)


    2 found this helpful
    thumb_up
    thumb_down

  • View Best Answer in replies below

    Read these next…

    • Curated Snap! -- No-Password Logins, Solar Powered Water Filter, Glitch in the Matrix?

      Snap! — No-Password Logins, Solar Powered Water Filter, Glitch in the Matrix?

      Spiceworks Originals

      Your daily dose of tech news, in brief.

      Welcome to the Snap!

      Flashback: February 9, 1996: Introduction of the Bandai Pippin (Read more HERE.)

      Bonus Flashback: February 9, 1990: Galileo Probe does a Venus Flyby (Read more HERE.)

      You nee…

    • Curated Roku TV being used as Wallboard Issues

      Roku TV being used as Wallboard Issues

      Hardware

      Helping someone out at their shop. They have 4 large Roku screens and 2 laptops with dual HDMI ports for video. They are viewing static website business dashboards and PowerPoint. At first all 4 screens connected to wireless, worked for a while but with a…

    • Curated Charging for SSO

      Charging for SSO

      Security

      We have SSO set up with around 5 or 6 solution providers via our M365. Not one of them charges for this, they just sent us the documentation.I identified another online service in use by one of our departments which would benefit from using SSO for staff …

    • Curated Spark! Pro series - 9th February 2023

      Spark! Pro series — 9th February 2023

      Spiceworks Originals

      Today in History: America meets the Beatles on “The Ed Sullivan Show”

      At approximately 8:12 p.m. Eastern time, Sunday, February 9, 1964, The Ed Sullivan Show returned from a commercial (for Anacin pain reliever), and there was Ed Sullivan standing …

    • Curated Green Brand Rep Wrap-Up: January 2023

      Green Brand Rep Wrap-Up: January 2023

      Spiceworks Originals

      Source Opens a new window Opens a new windowHi, y’all — Chad here. A while back, we used to feature the top posts from our brand reps (aka “Green Gals/Guys/et. al.) in a weekly or monthly wrap-up post. I can’t specifically recall which, as that was ap…

    Итак CentOS по умолчанию для системы использует LVM, что правильно для кооперативных продуктов.

    Для начала посмотрим сколько у нас израсходовано ресурса файловой системы.

    df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           7.4G  7.4G   0G   100% /
    tmpfs                 1.9G     0  1.9G   0% /dev/shm
    /dev/sda1             485M   45M  415M  10% /boot

    И о ужас мы использовали всё место на диске. Что же делать, но погодите у нас же используется VLM так что не расстраиваемся и принимаемся за работу.

    Установим диск и включим систему.
    У меня диск определился как устройство /dev/sdb

    По скольку мы добавляем диск менее 2TB то можем воспользоваться старым добрым fdisk‘ом.

    fdisk /dev/sdb 
    
    WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
             switch off the mode (command 'c') and change display units to
             sectors (command 'u').
    
    Command (m for help): n   # Создадим новый раздел
    Command action
       e   extended
       p   primary partition (1-4)
    p                         # Тип раздела primary partition
    
    Partition number (1-4): 1 # Номер раздела 1, займём всё пространство, остальные параметры по умолчанию
    First cylinder (1-11748, default 1): 
    Using default value 1
    Last cylinder, +cylinders or +size{K,M,G} (1-11748, default 11748): 
    Using default value 11748
    
    Command (m for help): t   # Скажем системе, что это LVM раздел
    Selected partition 1
    Hex code (type L to list codes): 8e
    Changed system type of partition 1 to 8e (Linux LVM)
    
    Command (m for help): p   # Посмотрим что у нас получилось
    
    Disk /dev/sdb: 96.6 GB, 96636764160 bytes
    255 heads, 63 sectors/track, 11748 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x80893f78
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1               1       11748    94365778+  8e  Linux LVM
    
    Command (m for help): w    # Запишем изменения на диск
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.

    Создадим Physical volume в системе

    pvcreate /dev/sdb1 
      Writing physical volume data to disk "/dev/sdb1"
      Physical volume "/dev/sdb1" successfully created

    Посмотрим существующие Physical volume

    pvdisplay 
      --- Physical volume ---
      PV Name               /dev/sda2
      VG Name               VolGroup
      PV Size               9.51 GiB / not usable 3.00 MiB
      Allocatable           yes (but full)
      PE Size               4.00 MiB
      Total PE              2434
      Free PE               0
      Allocated PE          2434
      PV UUID               vtPIUY-c3pR-uAOa-EHjF-VHGk-Ercv-BNVRVI
       
      "/dev/sdb1" is a new physical volume of "89.99 GiB"
      --- NEW Physical volume ---
      PV Name               /dev/sdb1
      VG Name               
      PV Size               89.99 GiB
      Allocatable           NO
      PE Size               0   
      Total PE              0
      Free PE               0
      Allocated PE          0
      PV UUID               V1C4B4-WK7N-X37f-XWsX-PH8x-WYa1-OpSFj9
    

    Как мы можем убедиться наш Physical volume не находится ни в одной Volume Group 

    Посмотрим существующие Volume Group

    vgdisplay 
      --- Volume group ---
      VG Name               VolGroup
      System ID             
      Format                lvm2
      Metadata Areas        1
      Metadata Sequence No  3
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                2
      Open LV               2
      Max PV                0
      Cur PV                1
      Act PV                1
      VG Size               9.51 GiB
      PE Size               4.00 MiB
      Total PE              2434
      Alloc PE / Size       2434 / 9.51 GiB
      Free  PE / Size       0 / 0   
      VG UUID               hQ2EfR-x70X-mXYs-hKJ9-NpXW-0KGz-1HPjKG
    

    У нас есть одна Volume Group в которую мы собственно и добавим наш Physical volume.

    vgextend VolGroup /dev/sdb1
      /etc/lvm/archive/.lvm_hostname_21964_725831346: write error failed: No space left on device
      Volume group "VolGroup" metadata archive failed.
      Internal error: Attempt to unlock unlocked VG #orphans.

    Если вы столкнулись с такой проблемой, значит ваша файловая система переполнена. Удалим ненужное, в принципе хватит нескольких свободных мегабайт и повторим попытку.

    vgextend VolGroup /dev/sdb1
      Volume group "VolGroup" successfully extended

     Увеличим Volume Group, займём всё свободное пространство.

    lvextend -l 100%FREE /dev/VolGroup/lv_root 
      Extending logical volume lv_root to 89.99 GiB
      Logical volume lv_root successfully resized

    Увеличим размер файловой системы командой resize2fs

    В отличие от некоторых других менее гибких FS, ext4 можно увеличивать на горячую.

    resize2fs /dev/VolGroup/lv_root 
    resize2fs 1.41.12 (17-May-2010)
    Filesystem at /dev/VolGroup/lv_root is mounted on /; on-line resizing required
    old desc_blocks = 1, new_desc_blocks = 6
    Performing an on-line resize of /dev/VolGroup/lv_root to 23590912 (4k) blocks.
    The filesystem on /dev/VolGroup/lv_root is now 23590912 blocks long.

    Всё теперь мы можем убедиться что у нас много свободного места.

    df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/VolGroup-lv_root
                           89G  7.4G   77G   9% /
    tmpfs                 1.9G     0  1.9G   0% /dev/shm
    /dev/sda1             485M   45M  415M  10% /boot

    I have a VM disk I’m trying to extend. OS is Ubuntu 12.04.

    I have added a more space to the «Extended» partition, /dev/sda2, now at 400GB
    1st LVM /dev/sda5 is full at 200GB, added another LVM /dev/sda6 at 200GB

    pvcreate /dev/sda6 — successful

    vgextend EnterVolumeGroupNameHere /dev/sda6 — i get this error
    /etc/lvm/archive: mkdir failed: No space left on device
      /etc/lvm/cache/.cache.tmp: write error failed: No space left on device

    lvextend -L +200G /dev/US01SV-SLNG01/root
      /etc/lvm/archive: mkdir failed: No space left on device
      /etc/lvm/cache/.cache.tmp: write error failed: No space left on device

     resize2fs /dev/US01SV-SLNG01/root
    resize2fs 1.42 (29-Nov-2011)
    The filesystem is already 50258944 blocks long.  Nothing to do!

    I can’t seem to get the volume group to extend to the 2nd LVM (/dev/sda6).
    Can you help please?

    more info:
    ——————————————
     df -hT
    Filesystem                      Type  Size  Used Avail Use% Mounted on
    /dev/mapper/US01SV—SLNG01-root ext4  189G  189G     0 100% /

      ls -al /dev/sda*
    brw-rw—- 1 root disk 8, 0 Nov 30 10:44 /dev/sda
    brw-rw—- 1 root disk 8, 1 Nov 30 10:44 /dev/sda1
    brw-rw—- 1 root disk 8, 2 Nov 30 10:44 /dev/sda2
    brw-rw—- 1 root disk 8, 5 Nov 30 10:44 /dev/sda5
    brw-rw—- 1 root disk 8, 6 Nov 30 10:52 /dev/sda6
    ————————————
     parted -l
    Model: VMware Virtual disk (scsi)
    Disk /dev/sda: 429GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number  Start   End    Size   Type      File system  Flags
     1      1049kB  256MB  255MB  primary   ext2         boot
     2      257MB   429GB  429GB  extended
     5      257MB   215GB  214GB  logical                lvm
     6      215GB   429GB  215GB  logical                lvm

    Model: Linux device-mapper (linear) (dm)
    Disk /dev/mapper/US01SV—SLNG01-swap_1: 8628MB
    Sector size (logical/physical): 512B/512B
    Partition Table: loop

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

    Model: Linux device-mapper (linear) (dm)
    Disk /dev/mapper/US01SV—SLNG01-root: 206GB
    Sector size (logical/physical): 512B/512B
    Partition Table: loop

    Number  Start  End    Size   File system  Flags
     1      0.00B  206GB  206GB  ext4

    Понравилась статья? Поделить с друзьями:
  • Luxura v5 ошибка е2
  • Luxeon avr 500d ошибка h
  • Lutris dxvk error
  • Lust sans x error sans
  • Lunch lady fatal error