Ошибка check free disk space

I am using Postgres 9.4. I have a database that \l+ tells me is 164 GB. When I try to run VACUUM FULL on the database, I get this error (after many hours):

ERROR:  could not extend file "base/18222/20547.2": wrote only 4096 
        of 8192 bytes at block 279347
HINT:  Check free disk space.

I have 320GB of SSD on the server of which 89GB is available:

$ df -h
Filesystem                 Size  Used Avail Use% Mounted on
rootfs                     315G  211G   89G  71% /
udev                        10M     0   10M   0% /dev
tmpfs                      6.4G  192K  6.4G   1% /run
/dev/disk/by-label/DOROOT  315G  211G   89G  71% /
tmpfs                      5.0M     0  5.0M   0% /run/lock
tmpfs                       13G  4.0K   13G   1% /run/shm

I can’t easily add more disk space to the server. Is there anything else I can do?

I found this question, so I can try that if needed. But I was wondering if I could tell VACUUM FULL to work with less memory.

Community's user avatar

asked Mar 29, 2015 at 10:01

Richard's user avatar

1

According to postgresql documentation:

VACUUM FULL actively compacts tables by writing a complete new
version of the table file with no dead space. This minimizes the size
of the table, but can take a long time. It also requires extra disk
space for the new copy of the table, until the operation completes.

So if you have one big table vacuum full can easily eat all your disk space. Maybe the best thing would be to do a full backup/restore — the result will be the same as if you did a vacuum full.

answered Apr 11, 2015 at 7:13

Dragan Matic's user avatar

I am getting space issue while running a batch process on PostgreSQL database.

However, df -h command shows that machine has enough space

enter image description here

below is the exact error

org.springframework.dao.DataAccessResourceFailureException: PreparedStatementCallback; SQL [INSERT into BATCH_JOB_INSTANCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION) values (?, ?, ?, ?)]; ERROR: could not extend file "base/16388/16452": No space left on device
  Hint: Check free disk space.

What is causing this issue?

EDIT

postgres data directory is /var/opt/rh/rh-postgresql96/lib/pgsql/data

df -h /var/opt/rh/rh-postgresql96/lib/pgsql/data
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda2      100G   63G   38G  63% /

asked Jun 13, 2018 at 9:40

YogeshR's user avatar

YogeshRYogeshR

1,6062 gold badges22 silver badges43 bronze badges

5

Most likely there are some queries that create large temporary files which fill up your hard disk temporarily. These files will be deleted as soon as the query is done (or has failed), so the file system has enough free space when you look.

Set log_temp_files = 10240 in postgresql.conf (and reload) to log all temporary files exceeding 10 MB, then you can check the log file to see if this is indeed the reason.

Try to identify the bad queries and fix them.

If temporary files are not the problem, maybe temporary tables are. They are dropped automatically when the database session ends. Does your application use temporary tables?

Another possibility might be files created by something else than the database.

answered Jun 13, 2018 at 11:22

Laurenz Albe's user avatar

Laurenz AlbeLaurenz Albe

211k17 gold badges207 silver badges266 bronze badges

7

обновление, no space left on device ☑ 0

DeeK

09.01.23

12:29

8.3.20.2180

обновление бух 3.0 с 3.0.123.26 на 3.0.127.49

postgre 10

53100:error: could not extend file «base/52185646/95696157»: no space left on device HINT: check free disk space

размер базы около 20Гб

свободного места на тот момент было 7ГБ

загрузили бэкап, все ок

админ и руководство хотят узнать есть ли методы анализа требуемого места для предстоящего обновления

я не знаю таких методов, помогите найти вразумительные слова для них, или может предложите решение

1

Builder

09.01.23

12:33

(0) Жесть, экономить место на диске? Вы серьезно? 7 гигов свободно????

ИМХО на диске должно быть хотя бы в 2-3 раза больше места чем размер базы.

2

DeeK

09.01.23

12:34

(1) это само собой, я сразу это сказал, налейте места и забудем на ближайшие несколько лет

но им хочется анализ

3

PLUT

09.01.23

12:34

если перекладывать из одних таблиц в другие при реструктуризации базы, логично предположить, что свободного места должно быть не меньше текущего размера базы + логи транзакций?

если база 20 Гектар, то и места должно быть не меньше 20 Га?

4

Ryzeman

09.01.23

12:39

>>есть ли методы анализа требуемого места для предстоящего обновления

Не думаю, если при обновлении не написано ничего в подсказках, но если

>>размер базы около 20Гб

>>свободного места на тот момент было 7ГБ

тут ИМХО и так более чем очевидно. Если у вас там не раритетные суперскоростные скази-диски или не оптаны лимитированной серии, то смысл крохоборить?…

5

PLUT

09.01.23

12:40

(4) ну как вариант арендовать SSD диск на время обновления, после обновления базу вернуть взад

6

DeeK

09.01.23

12:42

то есть метод анализа примерно такой как (3)?

минимум размер базы плюс подушка какая-то

7

Trimax

09.01.23

12:43

(2) Дык анализ уже произведен средствами 1С: Нет места на жестком диске….

8

Aleksey

09.01.23

12:43

(6) За анализом им к психологу, он им поставит анализ.

Или анализ чего им нужно?

9

DeeK

09.01.23

12:44

(8) требуемого свободного места на диске для корректного завершения обновления

10

DeeK

09.01.23

12:44

(7) они хотят перед обновлением оценивать — хватит места или нет

11

Ryzeman

09.01.23

12:45

(8) Ну автор нормальный вопрос задал, просто читать всю ветку надо) Типа предварительный анализ перед обновлением — хватит ли места.

12

PLUT

09.01.23

12:45

(7) особенно «анализ» обновления типовой ERP (соблюдайте спокойствие. поезд скоро отправится. обновление в зависимости от количества данных займет от нескольких минут до нескольких дней)

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

а еще обновление через копию базы забыл :)

13

Trimax

09.01.23

12:47

(9) Это вопрос должен быть адресован админу. Железо — его головняк. Он должен обеспечить работоспособность программы.

14

Ryzeman

09.01.23

12:48

(6) я бы заморачивался если бы речь шла на терабайты. Но «жалкие» (по нынешним дням) ~50 гигов держать свободными уж точно можно…

15

PLUT

09.01.23

12:48

(10)

п.1 бэкап базы.

п.2 обновление — > no space left on device HINT: check free disk space

БИНГО! предварительный анализ — недостаточно места! <- вы находитесь здесь

п.4 загружаем из бэкапа базу

п.5 пишем на форум, читаем, много думаем…

16

Asmody

09.01.23

12:51

(0) если кратко, то примерно так:

1. через сравнение-объединение определяешь объекты с изменившейся структурой

2. смотришь объем таблиц этих объектов вместе с индексами + объем таблиц Config

3. умножаешь на 2, но лучше сразу на π

вот тебе будет оценка

17

PLUT

09.01.23

12:52

(16) кстати да, и неделю времени на анализ (это ж сколько денег можно заработать, если франь)

18

DeeK

09.01.23

12:53

(16) спасибо за конкретику

(17) тоже об этом подумал

я думаю мой конспект из этой темы их удовлетворит, всем спасибо, можно закрывать

19

ViSo76

09.01.23

13:14

Есть шанс что ошибки на диске

20

Aleksey

09.01.23

13:53

(11) так кроме эмпирического пути других методов нет, даже (размер базы умножь на 2) и то иногда не спасает, тем более когда модель восстановления стоит FULL а не простая.

Так что только делать обновление на копии и смотреть сколько заняло место

21

bolobol

09.01.23

16:25

(20) И как же это посмотреть? После обновления база занимает +/- столько же, сколько и до

22

bolobol

09.01.23

16:28

А по сути вопроса, если грубо, то: — да ну вас нахрен, даже голову напрягать не стоит из-за 50 гигабайтов…

23

Новый1сник2

09.01.23

16:30

(0) обновлял на днях бух корп (размер не смотрел), места на диске было 10г свободных, при обновлении глюкануло что не достаточно места. пришлось чистить немного и повторно обновлять

24

Новый1сник2

09.01.23

16:33

(О) размер диска какой? столкнулся с тем что под пользователем, которым обновлял. в темпах пользователя накопился кэш от обновлений, примерно 50 г. можно почистить

25

Aleksey

09.01.23

16:35

(21) запустить стандартный виндовый счетчик свободного место на время обновления и смотреть минимальное значение?

26

bolobol

09.01.23

16:37

(25) Спасибо, не знал что такое вообще есть стандартное в винде

27

Aleksey

09.01.23

16:44

Счетчики производительности для дисковой подсистемы

%Free Space — Объем свободного дискового пространства на выбранном логическом диске, в процентах.

https://windowsnotes.ru/other/schetchiki-proizvoditelnosti-dlya-diskovoj-podsistemy/

Ну или по 1С-совски

Мониторинг свободного места на диске с помощью OneScript

https://infostart.ru/1c/articles/1450352/

28

Kassern

09.01.23

16:58

(27) Все же можно проще, без всяких OneScript

Только что на коленке собрал

    FSO=Новый COMОбъект(«Scripting.FileSystemObject»);

    Для каждого ТекДиск Из FSO.Drives Цикл

        Если  ТекДиск.DriveType=2 Тогда

            СвободныйОбъем = Окр(fso.GetDrive(ТекДиск.DriveLetter).FreeSpace/1048576,1);

            Сообщить(«Диск «+ТекДиск.DriveLetter+» свободно «+СвободныйОбъем+» Мб.»);    

        КонецЕсли;    

    КонецЦикла;

29

Kassern

09.01.23

16:59

30

Aleksey

09.01.23

17:06

(28) там вроде как ограничения типа с сетевыми дискми не работает. или в виртуалки чудит, короче тестить надо

31

bolobol

09.01.23

17:07

(28) В (25) говорят, что всё уже написано до Вас

32

Kassern

09.01.23

17:17

(30) Все же есть)

DriveType

Возвращаемое значение: число — определяет тип ресурса. Возможные значения:

    0 — неизвестное устройство.

    1 — устройство со сменным носителем.

    2 — жёсткий диск.

    3 — сетевой диск.

    4 — CD-ROM.

    5 — RAM-диск.

hp-concentra-wrapper-portlet



Actions

When too little free space is available on your computer hard drive, Windows updates might not install, apps and files might
not download, and low disk space errors or warning messages might display. The computer or tablet performance can also become
unreliable. Use these procedures to resolve these issues and errors.

Freeing up space on the hard drive

Empty the Recycle Bin, remove unwanted files and programs, and adjust System Restore settings to free up space on your hard
drive.

Running HP Performance Tune-up Check to free up disk space

Resolve low disk space issues using HP Performance Tune-up Check.

  1. In Windows, search for and open HP Support Assistant, or click the app icon in the taskbar.

    If the app is not installed on your computer, download the latest version from the HP Support Assistant website.

    Note:

    HP Support Assistant is required to run HP Performance Tune-up Check.

  2. If the tool does not automatically open, search for and open HP Support Assistant. Select your device, and then click Optimize your performance in the Fixes & Diagnostics section.

    If you are unable to run the tool, see Removing unwanted files with Storage Sense.

  3. Under Additional Options, select Empty Recycle Bin and Clean Web-browsers history, cookies and cache, and then click Optimize.

    The tool removes unwanted files from your hard drive.

    The HP Performance Tune-up Check home screen

If the issue persists, remove unwanted files with Storage Sense.

Removing unwanted files with Storage Sense

Using Storage Sense frees up space on your computer. When configured properly, Storage Sense can automatically delete unwanted
files, such as temporary files, old items in the recycle bin, and files in the Downloads folder that have not been recently
accessed or used, including old versions of Windows.

  1. Search for and open Storage settings.

  2. On the Storage window, select Temporary files.

    Selecting Temporary files on the Storage settings window

  3. Select the temporary files you want to delete, and then click Remove files.

    CAUTION:

    HP recommends that you do not select the Downloads option. Doing so might delete personal files.

    Selecting temporary files to remove from the computer

  4. Return to the Storage window, select On beneath the information about Storage Sense, and then select Configure Storage Sense or run it.

    Turning on Storage Sense and selecting Configure Storage Sense or run it now

  5. On the Configure Storage Sense or run it now window, select how often Storage Sense runs, deletes temporary files, and empties the recycle bin and Downloads folder.

    Configuring Storage Sense settings

  6. Scroll down to Free up space now, and then click Clean now to run Storage Sense immediately using the settings previously selected.

    Selecting the Clean now button to run Storage Sense immediately using the settings previously selected

Removing unwanted programs with Windows 10

You can remove unused or unwanted programs from your computer to increase the space on your hard drive.

  1. Search for and open Apps and features.

  2. In the Apps & features window, select the app you want to remove, and then click Uninstall.

    Clicking Uninstall in the Apps &amp; features settings

  3. Click Uninstall again to confirm.

Windows removes the app from the computer.

Adjusting System Restore settings to free up disk space

System Restore is a feature of Windows that can revert system software and settings back to a particular date. System Restore
does this by saving the changes made to system files in a restore point. Restore points use a lot of hard drive space. Adjusting
the System Restore settings can free up hard drive space.

  1. Search for and open Control Panel.

  2. In the Control Panel Search field, type system, and then select System.

    Selecting the System option in the Control Panel app

  3. On the System home screen, select System protection.

    Selecting 'System protection' on the System home screen

  4. On the System Protection tab, click Configure.

    Clicking Configure on the System Protection tab

  5. To reduce the amount of hard drive space the system reserves for system restores, slide the Max Usage slider bar to a lower percentage. You can choose more or less depending on how many restore points you want and the capacity
    of your hard drive.

    Changing the Max Usage slider to a lower percentage

  6. Click OK to save the settings, and then click OK again to exit the System Properties window.

If the issue persists, confirm that enough hard drive space is available.

Confirming that enough hard drive space is available

Check the amount of free space on the hard drive. If the free space is under 5% of the total disk space, free up more space
on the disk.

  1. Open File Explorer, and then navigate to This PC.

  2. Under Devices and drives, right-click the main hard drive (usually C:), and then select Properties.

    Selecting Properties from the drop-down menu of the main hard drive

  3. Click the General tab to view the amount of free space available on the hard drive.

    Checking the amount of free space on the main hard drive

  4. If less than 5% of the total hard drive space is available, run HP Performance Tune-up Check, remove files with Storage Sense,
    and remove unwanted programs to make more disk space available.

Additional tips to free up space

Use the following procedures to prevent storage problems.

Using more efficient storage settings in Windows 10

If your computer has two or more drives, storing personal files on the main drive can cause the PC to run slower. To improve
performance, move personal files to a secondary hard drive.

  1. Search for and open Storage settings.

  2. On the Storage window, check the remaining storage space of the main drive and review the different types of files and the space they use.
    This information can help you decide which content to save on another drive. Click Show more categories to view additional files.

    Storage usage by content type

  3. Scroll down to More storage settings, and then select Change where new content is saved.

    Selecting 'Change where new content is saved'

  4. In the list, click the drop-down menu under the type of content you want saved to a different hard drive. Then, select the
    drive where you want new content saved.

    CAUTION:

    Do not save content to the Recovery drive. Storing content on this drive can make the operating system unrecoverable in the event of a problem.

    Selecting drive choices to save space on the main drive

  5. After changing the drive designation, click Apply to save the changes.

Configuring Storage Sense to free up space automatically

Using Storage Sense frees up space on your computer. When configured properly, Storage Sense can automatically delete unwanted
files, such as temporary files, old items in the recycle bin, and files in the Downloads folder that have not been recently
accessed or used.

Storage Sense does not remove all the unneeded files. In addition to the files that are automatically deleted, you might need
to delete other files, such as update logs.

  1. Search for and open Storage settings.

  2. On the Storage window, select On beneath the information about Storage Sense, and then select Configure Storage Sense or run it.

    Turning on Storage Sense and selecting Configure Storage Sense or run it now

  3. On the Configure Storage Sense or run it now window, select how often Storage Sense runs, deletes temporary files, and empties the recycle bin and Downloads folder.

    Note:

    Depending on your version of Windows, Storage Sense options might vary.

    • Run Storage Sense: Use the drop-down menu to select when you want Storage Sense to run.

    • Temporary Files: Select the check box to delete temporary files that your apps aren’t using. Then, use the drop-down menus to decide when
      to delete files from the recycle bin and Downloads folder.

    • Free up space now: Select Clean now to run Storage Sense immediately using the settings previously selected.

    Configuring Storage Sense settings

Saving files to a new location on a secondary drive

To save files to a new location on a secondary or external hard drive, change the location of the folders to the new destination
to avoid confusion when saving files.

If you are using a removable storage device, such as a thumb drive, make sure to insert the device into the computer each
time you save to it.

  1. Open File Explorer, and then navigate to This PC.

  2. Right-click the Documents folder, and then select Properties.

    Selecting Properties from the drop-down menu of the Documents folder

  3. On the Document Properties window, select the Location tab, and then click Find Target.

    Selecting 'Find Target' on the Location tab

  4. Browse to the location of the new document folder, click the address bar, and then copy the new address.

  5. Clear the field on the Document Properties window, paste the new address in the field, and then click Apply.

    Pasting the new address in the Location field

  6. In the Move Folder box, click Yes to move your files and content from the old location to the new location.

    You can repeat this procedure to change the location folders to avoid confusion when saving files.

Moving files to an external drive

If you have data or files you want to save, but you do not need them very often, you can save them on a removable drive. Then,
you can connect the drive when you need the files, and they do not take up space on the main hard drive.

Make sure that the external storage device has sufficient unused space to accommodate the files you are moving to it.

  1. Connect the external drive, open the storage location on your computer, and then create a new folder on the drive.

  2. On the computer hard drive, open C:\Users\yourname.

  3. Right-click the My Documents or Documents folder, and then select Properties.

  4. On the Document Properties window, select the Location tab, and then click Move.

  5. In the dialog box, navigate to the new folder you created on the external hard drive, and then create a new folder inside
    it called Documents. Select that new folder.

  6. Click Select Folder, and then click OK to move the files.

  7. Click Yes to confirm, and then wait while the files are moved.

PostgreSQL – Could not extend file No space left on device. HINT: Check free disk space – A server stack is the collection of software that forms the operational infrastructure on a given machine. In a computing context, a stack is an ordered pile. A server stack is one type of solution stack — an ordered selection of software that makes it possible to complete a particular task. Like in this post about PostgreSQL – Could not extend file No space left on device. HINT: Check free disk space was one problem in server stack that need for a solution. Below are some tips in manage your linux server when you find problem about linux, centos, centos7, storage, postgresql.

I’ve been inserting data into PostgreSQL DB, and got the error message:

psycopg2.OperationalError: could not extend file "base/16384/61892": No space left on device
HINT: Check free disk space

I am using CentOS 7, and I’ve checked some of my status on my linux machine:

df -h

enter image description here

I’m pretty new to Linux, and based on the result of my df -h command, I could see that Linux storage system works differently than Windows.

It looks like PostgreSQL is pushing to /dev/mapper/centos-root, but it has only 50 GB available.

Question 1: How can I change it? How can I assign the extra free space that’s available in /dev/mapper/centos-home to my ~/centos-root directory?

Question 2: My machine has two Hard disk, 200 GB each. But according to my df-h command, it looked like I only have 200GB available. Why is this the case? How can I take advantage of full 400GB space?

It looks like the problem is that my /dev/mapper/centos-root is all filled up. I have inserted nearly 10,000,000 rows of data with 12 columns in PostgreSQL.

Question 3: Is this big enough to take up 50GB of space?

Thanks!

Edit: output of pvs, vgs, lvs

enter image description here

Your server is badly partitioned. This is not entirely your fault; rather, the default RHEL/CentOS settings are quite misleading in my opinion.

Let’s start from the description on the pvs; vgs; lvs command entered above. They are all related to LVM2, a Logical Volume Manager which, in short, enable you to create “flexible”, resizeable partitions:

  • pvs shows how the physical disks are attached to the LVM system. You had 2x 200 GB disks, but pvs only shows 1×200 GB physical device. This means your disks are in RAID1 (mirroring) and they are wholly assigned to LVM (ie: no physical space is unassigned);

  • vgs shows the Volume Group assigned to your physical devices and any usable free space. In your case free space is <4 MB, so basically you have no space free space. The next command explains what is using your space…

  • lvs shows you have two Logical Volumes (think them as partitions): a 50 GB root volume and a ~145 GB home volume. In short, your root volume (where PostgreSQL resides) is way smaller than your needs; rather, your home volume is very large considering how few data (< 5GB) it contains.

To solve the problem, you have two options:

  • relocate PostgreSQL under the home volume, for example under /home/pgsl. I would avoid this because /home is not the right place for a database and it will cause an administrative burden in the future. Moreover, you need to put SELinux into permissive mode (setenforce 0 + /etc/selinux/config editing) to let the relocation work;

  • shrink the home volume and enlarge root. This is easier said than done, especially if you are using XFS (default RHEL/CentOS filesystem), which does not support shrinking.

If and only if your data under home can be trashed / reloaded, you can follow the following steps to DELETE the home volume and enlarging root. Please note that a small error (both mine and your) WILL destroy your data (killing any cats in a ~100 KM range), and so I take NO RESPONSABILITY for the final outcome. If you are unsure, stop here and call a professional sysadmin for support. Ok, let’s go ahead; I’ll post a command sequence with the relative description:

  • umount /home: this unmount (ie “disable”) the home volume;
  • lvremove centos/home: this permanently destroy /home and all its content;
  • lvextend centos/root -L +100G: this expand the root volume by 100 GB;
  • xfs_growfs /: assuming you are using XFS, this expand the root filesystem to match the underlying, extended volume. If you are using ext4 (which is improbable), you need to issue resize2fs /dev/centos/root.

Понравилась статья? Поделить с друзьями:
  • Ошибка check esp рено меган 3
  • Ошибка check engine рено
  • Ошибка check engine oil level на пежо 308
  • Ошибка check emissions рено сценик 2
  • Ошибка check coolant level bmw