Problem with btrfs snapshots
Hello.
We are have a strange situation with btrfs snapshot. We have a special script to create snapshot and if we create several snapshots in the same time we get ENOSPC error. But if we create snapshots one after another with a little pause between (about 10 minutes), then everything looks ok. Is there any command to determine that it is safe to make another snapshot?
# uname -a
Linux OraCI2.sigma-it.local 4.8.4-1.el7.elrepo.x86_64 #1 SMP Sat Oct 22
11:47:38 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
# btrfs --version
btrfs-progs v4.8.1
# btrfs fi show
Label: 'BUILDS' uuid: ce8952ff-30e5-48c5-8cd2-529c95667aa8
Total devices 1 FS bytes used 356.82GiB
devid 1 size 1000.00GiB used 383.00GiB path /dev/nvme0n1p1Label: none uuid: a712598d-cc4f-4dc5-bdfb-de7ae432b109
Total devices 1 FS bytes used 4.71TiB
devid 1 size 7.66TiB used 4.96TiB path/dev/mapper/OraCI2-docker--data
Label: none uuid: 89c0495f-ed26-4d66-b83b-ffb5882bd082
Total devices 1 FS bytes used 880.43GiB
devid 1 size 1.93TiB used 913.01GiB path /dev/nvme0n1p2
# btrfs fi df /var/lib/docker/db/STANDS Data, single: total=4.89TiB, used=4.68TiB System, DUP: total=8.00MiB, used=592.00KiB Metadata, DUP: total=35.00GiB, used=26.29GiB GlobalReserve, single: total=512.00MiB, used=4.41MiB
Best regards,
Dmitry Nechaev
С уважением,
Дмитрий Нечаев,
Ведущий инженер Группы сетевого и системного администрирования Отдела системной интеграции ООО "СИГМА"
Тел: +7 812 602 27 72 доб. 158
Факс: +7 812 602 2770
e-mail: [email protected]
Have you tryed "sync" between create several snapshots commands?
2016-11-03 13:22 GMT+01:00 Дмитрий Нечаев <[email protected]>:
Quoted 48 lines
Hello.
We are have a strange situation with btrfs snapshot. We have a special script to create snapshot and if we create several snapshots in the same time we get ENOSPC error. But if we create snapshots one after another with a little pause between (about 10 minutes), then everything looks ok. Is there any command to determine that it is safe to make another snapshot?# uname -a Linux OraCI2.sigma-it.local 4.8.4-1.el7.elrepo.x86_64 #1 SMP Sat Oct 22 11:47:38 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux # btrfs --version btrfs-progs v4.8.1 # btrfs fi show Label: 'BUILDS' uuid: ce8952ff-30e5-48c5-8cd2-529c95667aa8 Total devices 1 FS bytes used 356.82GiB devid 1 size 1000.00GiB used 383.00GiB path /dev/nvme0n1p1Label: none uuid: a712598d-cc4f-4dc5-bdfb-de7ae432b109
Total devices 1 FS bytes used 4.71TiB
devid 1 size 7.66TiB used 4.96TiB path/dev/mapper/OraCI2-docker--dataLabel: none uuid: 89c0495f-ed26-4d66-b83b-ffb5882bd082
Total devices 1 FS bytes used 880.43GiB
devid 1 size 1.93TiB used 913.01GiB path/dev/nvme0n1p2# btrfs fi df /var/lib/docker/db/STANDS Data, single: total=4.89TiB, used=4.68TiB System, DUP: total=8.00MiB, used=592.00KiB Metadata, DUP: total=35.00GiB, used=26.29GiB GlobalReserve, single: total=512.00MiB, used=4.41MiBBest regards,
Dmitry NechaevС уважением,
Дмитрий Нечаев,
Ведущий инженер Группы сетевого и системного администрирования Отдела системной интеграции ООО "СИГМА"
Тел: +7 812 602 27 72 доб. 158
Факс: +7 812 602 2770
e-mail: [email protected]--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
(copy for mainlinglist)
2016-11-03 15:16 GMT+01:00 Дмитрий Нечаев <[email protected]>:
Yes. We tried "sync" in our script but it doesn't help. It works only then we make one snapshot at a time. Even if we use "sync" before and after creating snapshot, it doesn't help.
Quoted 6 lines · Peter Becker
(copy for mainlinglist)
2016-11-03 15:16 GMT+01:00 Дмитрий Нечаев <[email protected]>:
Yes. We tried "sync" in our script but it doesn't help. It works only then we make one snapshot at a time. Even if we use "sync" before and after creating snapshot, it doesn't help.
You might try 'btrfs filesystem sync' called on the filesystem the snapshots are being created on. This works differently from the sync() syscall used by regular 'sync', and as a result forces metadata out as well as regular data (and it's almost certainly a metadata issue you are seeing), and it won't have as much impact on the rest of the system.
Part of script:
================
btrfs filesystem sync
cp -pR --reflink
btrfs filesystem sync
================
So if another copy or two of script is starting in the moment, then first snapshot is making - then we receive ENOSPC.
-----Original Message-----
From: Austin S. Hemmelgarn [mailto:[email protected]]
Sent: Thursday, November 03, 2016 6:07 PM
To: Peter Becker; Дмитрий Нечаев; linux-btrfs
Subject: Re: Problem with btrfs snapshots
Quoted 6 lines · Peter Becker
(copy for mainlinglist)
2016-11-03 15:16 GMT+01:00 Дмитрий Нечаев <[email protected]>:
Yes. We tried "sync" in our script but it doesn't help. It works only then we make one snapshot at a time. Even if we use "sync" before and after creating snapshot, it doesn't help.
You might try 'btrfs filesystem sync' called on the filesystem the snapshots are being created on. This works differently from the sync() syscall used by regular 'sync', and as a result forces metadata out as well as regular data (and it's almost certainly a metadata issue you are seeing), and it won't have as much impact on the rest of the system.