Skip to contentSkip to conversation

Problem with btrfs snapshots

DISCUSSION Дмитрий Нечаев 3 participants 5 messages Nov 3, 2016 – Nov 7, 2016 1 message not in the archive Btrfs file system

lore
Share & tools
lore
#0 lore raw

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/nvme0n1p1

Label: 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]

#1 lore raw

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/nvme0n1p1

Label: 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]

--
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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

(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.

#4 lore raw
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.

#5 lore raw

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.