Skip to contentSkip to conversation

Adding a disk fails

DISCUSSION Carl Cook 5 participants 14 messages Jan 20, 2011 – Jan 21, 2011 Btrfs file system

lore
Share & tools
lore

Carl Cook

author
#0 lore raw

Well I've just tried to add a disk to another, but it fails. I created the first (starting with no traditional partitions) with:

# mkfs.btrfs /dev/sdb

Then I mounted it to /media/backups and put lots of files on it. I shut down the system, added another disk. Set it up with:

# mkfs.btrfs /dev/sdc
WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
fs created label (null) on /dev/sdc
        nodesize 4096 leafsize 4096 sectorsize 4096 size 1.82TB
Btrfs Btrfs v0.19
# btrfs device scan
Scanning for Btrfs filesystems
#
(... Nothing?  Not even my known mounted sdb drive?)
# btrfs device add /dev/sdc /media/backups
ERROR: error adding the device '/dev/sdc'

It gives no clue as to what might possibly be the problem. I want raid0.

Also I can not understand this:
"Note: While subvolumes can be created anywhere in the filesystem tree, in order to be mounted by name a subvolume or snapshot must be in the root of the btrfs filesystem."

I want to do this, but do not know what this means. Tentatively I've created a BTRFS volume and mounted it on /media/backups. I then created subvolumes as backup-hex, backup-droog, snaps-hex and snaps-droog. When I created a snapshot it created a subdir under snaps-hex called hex-root.

It won't allow me to remove snapshots. (Debian Testing)

Also does anyone know how to create a shapshot with the current date in the name?

#1 lore raw
Quoted 15 lines · Carl Cook

Well I've just tried to add a disk to another, but it fails. I created the first (starting with no traditional partitions) with: # mkfs.btrfs /dev/sdb

Then I mounted it to /media/backups and put lots of files on it. I shut down the system, added another disk. Set it up with: # mkfs.btrfs /dev/sdc WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL WARNING! - see http://btrfs.wiki.kernel.org before using fs created label (null) on /dev/sdc nodesize 4096 leafsize 4096 sectorsize 4096 size 1.82TB Btrfs Btrfs v0.19 # btrfs device scan Scanning for Btrfs filesystems # (... Nothing? Not even my known mounted sdb drive?) # btrfs device add /dev/sdc /media/backups ERROR: error adding the device '/dev/sdc'

Quoted 2 lines

It gives no clue as to what might possibly be the problem. I want raid0.

To add another disk you don't have to run mkfs.btrfs. For example:

# add the first disk
mkfs.btrfs /dev/sdb
# mount the disk
mount /dev/sdb /media/backups
# add another disk to the first one
btrfs device add /dev/sdc /media/backup

Note1: the filesystem has to be mounted
Note2: the medatada will be in raid1, the data in raid0 If you shutdown the system, at the reboot you should "scan" all the device in order to find the btrfs ones

# find the btrfs device
btrfs device scan
# mount the filesystem
mount /dev/sdb /media/backups 		# you can use also /dev/sdc
Quoted 7 lines

Also I can not understand this: "Note: While subvolumes can be created anywhere in the filesystem tree, in order to be mounted by name a subvolume or snapshot must be in the root of the btrfs filesystem."

I want to do this, but do not know what this means.

Suppose to have a btrfs filesystem in /dev/sdb

mount /dev/sdb /media/backup

mkidr /media/backup/dir-1
<create a lot of file under /media/backup>

# make a snapshot
btrfs filesystem snapshot /media/backup /media/backup/snapshot-2
# make another snapshot
btrfs filesystem snapshot /media/backup /media/backup/dir-1/snapshot-3
# umount the filesystem
umount /media/backup
# mount snapshot-2 directly
mount -o subvol=snapshot-2 /dev/sdb /media/backup
# if you try to mount snapshot-3 directly, you fail because this
# snapshot is not under the root of the btrfs filesystem
mount -o subvol=dir-1/snapshot-3 /dev/sdb /media/backup	 # -> error

If you look at the output of the command "btrfs subvolume list <path>" you can find the id of every subvolume. It is possible to use this ID to mount directly a subvolume. This permits to mount a "non-root" subvolume.

Quoted 7 lines

Tentatively I've
created a BTRFS volume and mounted it on /media/backups. I then created subvolumes as backup-hex, backup-droog, snaps-hex and snaps-droog. When I created a snapshot it created a subdir under snaps-hex called hex-root.

It won't allow me to remove snapshots. (Debian Testing)

Which kenel version debian testing uses ?

Quoted 2 lines

Also does anyone know how to create a shapshot with the current date in the name?

btrfs filesystem snapshot / /snapshot-$(date +"%Y-%m-%d")

Quoted 4 lines

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

author
#2 lore raw
Quoted 9 lines · On Thu 20 January 2011 14:13:22 Goffredo Baroncelli wrote:

To add another disk you don't have to run mkfs.btrfs. For example:

# add the first disk
mkfs.btrfs /dev/sdb
# mount the disk
mount /dev/sdb /media/backups
# add another disk to the first one
btrfs device add /dev/sdc /media/backup

Thanks Goffredo but as I say, I did this and it responds with
"ERROR: error adding the device '/dev/sdc'"
... it doesn't give a clue.

Quoted 7 lines

Note1: the filesystem has to be mounted
Note2: the medatada will be in raid1, the data in raid0 If you shutdown the system, at the reboot you should "scan" all the device in order to find the btrfs ones

# find the btrfs device
btrfs device scan

This must be done at every boot? If so, where is recommended, in rc.local?

Quoted 3 lines
# if you try to mount snapshot-3 directly, you fail because this
# snapshot is not under the root of the btrfs filesystem
mount -o subvol=dir-1/snapshot-3 /dev/sdb /media/backup	 # -> error

This is how I'd understood it, but when creating a subvolume in the root and putting a snalshot into it, it seems to make a further subvolume (or directory) with a redundant name. This would not be under the root, and may not be mountable?

Quoted 1 line

Which kenel version debian testing uses ?

2.6.32-5-amd64 with Debian patches.

Quoted 1 line

btrfs filesystem snapshot / /snapshot-$(date +"%Y-%m-%d")

Oh thank you.

#3 lore raw
Quoted 10 lines · On Friday 21 of January 2011 00:10:54 Carl Cook wrote:
Quoted 9 lines · On Thu 20 January 2011 14:13:22 Goffredo Baroncelli wrote:

To add another disk you don't have to run mkfs.btrfs. For example:
=20

# add the first disk
mkfs.btrfs /dev/sdb
# mount the disk
mount /dev/sdb /media/backups
=20
# add another disk to the first one
btrfs device add /dev/sdc /media/backup
Quoted 4 lines

=20
Thanks Goffredo but as I say, I did this and it responds with
"ERROR: error adding the device '/dev/sdc'"
... it doesn't give a clue.

You still have a btrfs on /dev/sdc, do a=20
dd if=3D/dev/zero of=3D/dev/sdc bs=3D8192
(overkill, but I don't remember which blocks have to be zeroed to destr= oy=20
btrfs superblock)
Then
btrfs dev add /dev/sdc /media backup

Quoted 10 lines

=20

Quoted 7 lines

Note1: the filesystem has to be mounted
Note2: the medatada will be in raid1, the data in raid0 If you shutdown the system, at the reboot you should "scan" all the device in order to find the btrfs ones
=20

# find the btrfs device
btrfs device scan

=20
This must be done at every boot? If so, where is recommended, in rc.=

local?

yes. rc.local is too late, unless you will also mount the volume from t= here=20
and not using /etc/fstab

--=20
Hubert Kario
QBS - Quality Business Software
02-656 Warszawa, ul. Ksawer=F3w 30/85
tel. +48 (22) 646-61-51, 646-74-24
www.qbs.com.pl
--
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

#4 lore raw
Quoted 4 lines · On Thu 20 January 2011 22:55:54 Hubert Kario wrote:

You still have a btrfs on /dev/sdc, do a
dd if=/dev/zero of=/dev/sdc bs=8192
(overkill, but I don't remember which blocks have to be zeroed to destroy btrfs superblock)

I gave up and started over. Maybe it should be clarified in the wiki that no mkfs should be done on additional volumes, as it's counterintuitive to some.

Quoted 2 lines

yes. rc.local is too late, unless you will also mount the volume from there and not using /etc/fstab

How and when then?

Quoted 3 lines

That depends - it has to be done before mounting. And if the device is part of the boot partition then you may put the "scan" command into an init-ramdisk.

This does not seem to have been sent to the listserv, as I only got it in a reply. This is likely incomplete.

Quoted 2 lines

Using something like "device=/dev/sdb,device=/dev/sdc" on fstab mount options should also work.

You mean as a substitute for a scan?

On my other server the btrfs array seems to mount just fine without any measures to scan. I don't understand this, nor why no specific advice is given about scanning on boot in the wiki.

#5 lore raw
Quoted 4 lines · On Friday, January 21, 2011 11:16:49 [email protected] wrote:
Quoted 3 lines · On Thu 20 January 2011 22:55:54 Hubert Kario wrote:

You still have a btrfs on /dev/sdc, do a
dd if=3D/dev/zero of=3D/dev/sdc bs=3D8192
(overkill, but I don't remember which blocks have to be zeroed to d=

estroy

Quoted 3 lines
Quoted 1 line

btrfs superblock)

=20
I gave up and started over. Maybe it should be clarified in the wiki=

that

Quoted 1 line

no mkfs should be done on additional volumes, as it's counterintuitiv=

e to

Quoted 3 lines

some.
=20

Quoted 1 line

yes. rc.local is too late, unless you will also mount the volume fr=

om

Quoted 3 lines
Quoted 1 line

there and not using /etc/fstab

=20
How and when then?

in, or before /etc/rcS.d/S35mountall.sh

Quoted 2 lines

=20

Quoted 1 line

That depends - it has to be done before mounting. And if the device=

is

Quoted 1 line
Quoted 1 line

part of the boot partition then you may put the "scan" command into=

an

Quoted 3 lines
Quoted 1 line

init-ramdisk.

=20
This does not seem to have been sent to the listserv, as I only got i=

t in a

Quoted 1 line

reply. This is likely incomplete.

It was sent to list, your MUA may have merged messages with identical M= essage-
ID.

Quoted 2 lines

=20

Quoted 1 line

Using something like "device=3D/dev/sdb,device=3D/dev/sdc" on fstab=

mount

Quoted 3 lines
Quoted 1 line

options should also work.

=20
You mean as a substitute for a scan?

Would seem so, but I haven't tried this

Quoted 2 lines

=20
On my other server the btrfs array seems to mount just fine without a=

ny

Quoted 1 line

measures to scan. I don't understand this, nor why no specific advi=

ce is

Quoted 1 line

given about scanning on boot in the wiki.

your distro may have alredy put it in initrd or initramfs (for example = fedora=20
and archlinux do)

--=20
Hubert Kario
QBS - Quality Business Software
02-656 Warszawa, ul. Ksawer=F3w 30/85
tel. +48 (22) 646-61-51, 646-74-24
www.qbs.com.pl
--
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

#6 lore raw
In reply to Carl Cook

Hallo, Carl,

Du meintest am 20.01.11:

Quoted 7 lines
Quoted 5 lines

If you shutdown the system, at the reboot you should "scan" all the device in order to find the btrfs ones

# find the btrfs device
btrfs device scan

This must be done at every boot?

Yes - this advice is added in the Wiki (?).

Quoted 1 line

If so, where is recommended, in rc.local?

That depends - it has to be done before mounting. And if the device is part of the boot partition then you may put the "scan" command into an init-ramdisk.

Viele Gruesse!
Helmut

#7 lore raw
Quoted 13 lines · Helmut Hullen

Hallo, Carl,

Du meintest am 20.01.11:

Quoted 7 lines
Quoted 5 lines

If you shutdown the system, at the reboot you should "scan" all the device in order to find the btrfs ones

# find the btrfs device
btrfs device scan

This must be done at every boot?

Quoted 7 lines

Yes - this advice is added in the Wiki (?).

Quoted 1 line

If so, where is recommended, in rc.local?

That depends - it has to be done before mounting. And if the device is part of the boot partition then you may put the "scan" command into an init-ramdisk.

Using something like "device=/dev/sdb,device=/dev/sdc" on fstab mount options should also work.

Signature · 1 line
Fajar
#8 lore raw
In reply to Carl Cook
Quoted 8 lines · Carl Cook
Quoted 7 lines · On Thu 20 January 2011 14:13:22 Goffredo Baroncelli wrote:

To add another disk you don't have to run mkfs.btrfs. For example:

# add the first disk
mkfs.btrfs /dev/sdb
# mount the disk
mount /dev/sdb /media/backups
Quoted 6 lines
Quoted 2 lines
# add another disk to the first one
btrfs device add /dev/sdc /media/backup

Thanks Goffredo but as I say, I did this and it responds with
"ERROR: error adding the device '/dev/sdc'"
.. it doesn't give a clue.

In your email you wrote that before adding the device you format it. Anyway I don't think that this is the problem.

Have you check which is reported in dmesg.

Quoted 10 lines
Quoted 8 lines

Note1: the filesystem has to be mounted
Note2: the medatada will be in raid1, the data in raid0 If you shutdown the system, at the reboot you should "scan" all the device in order to find the btrfs ones

# find the btrfs device
btrfs device scan

This must be done at every boot? If so, where is recommended, in rc.local?

Look at this thread, where I wrote anout a possible solution

http://www.mail-archive.com/[email protected]/msg04709.html

Quoted 6 lines
Quoted 5 lines

# if you try to mount snapshot-3 directly, you fail because this
# snapshot is not under the root of the btrfs filesystem
mount -o subvol=dir-1/snapshot-3 /dev/sdb /media/backup	 # -> error
Quoted 8 lines

This is how I'd understood it, but when creating a subvolume in the root and putting a snalshot into it, it seems to make a further subvolume (or directory) with a redundant name. This would not be under the root, and may not be mountable?

Quoted 1 line

Which kenel version debian testing uses ?

2.6.32-5-amd64 with Debian patches.

From a btrfs point of view, it is a very old kernel. IIRC in this kernel

is not supported the snapshot removal. I suggest you to update the kernel with a recent one.

Quoted 14 lines
Quoted 3 lines

btrfs filesystem snapshot / /snapshot-$(date +"%Y-%m-%d")

Oh thank you.

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

#9 lore raw
Quoted 8 lines · On Fri 21 January 2011 10:42:39 Goffredo Baroncelli wrote:
Quoted 3 lines

Thanks Goffredo but as I say, I did this and it responds with
"ERROR: error adding the device '/dev/sdc'"
.. it doesn't give a clue.

In your email you wrote that before adding the device you format it. Anyway I don't think that this is the problem.

Have you check which is reported in dmesg.

Absolutely no sign of a problem in dmesg or the logs.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

btrfs device scan

This must be done at every boot? If so, where is recommended, in rc.local?

Look at this thread, where I wrote anout a possible solution

http://www.mail-archive.com/[email protected]/msg04709.html

Thanks. I am suspecting scan is built into Debian. Not sure what to look for though, with all the darned variables.

Quoted 5 lines
Quoted 1 line

2.6.32-5-amd64 with Debian patches.

From a btrfs point of view, it is a very old kernel. IIRC in this kernel is not supported the snapshot removal. I suggest you to update the kernel with a recent one.

I've looked for a newer kernel sources, but there isn't one with Debian patches. I always compile my kernel.

#10 lore raw
In reply to Goffredo Baroncelli

Hallo, Goffredo,

Du meintest am 20.01.11:

Quoted 9 lines

To add another disk you don't have to run mkfs.btrfs. For example:

# add the first disk
mkfs.btrfs /dev/sdb
# mount the disk
mount /dev/sdb /media/backups
# add another disk to the first one
btrfs device add /dev/sdc /media/backup

^backups

Quoted 2 lines

Note1: the filesystem has to be mounted
Note2: the medatada will be in raid1, the data in raid0

And there seems to be an error; some options tell the sum of the sizes of /dev/sdb and /dev/sdc as available size, but perhaps you can only use the size of the smaller of the two devices - the system seems to work in a kind of RAID1.

The error is known but not yet fixed.

Viele Gruesse!
Helmut

#11 lore raw
In reply to Goffredo Baroncelli

Hallo, Goffredo,

Du meintest am 20.01.11:

Quoted 7 lines

To add another disk you don't have to run mkfs.btrfs. For example:

# add the first disk
mkfs.btrfs /dev/sdb
# mount the disk
mount /dev/sdb /media/backups
Quoted 5 lines
# add another disk to the first one
btrfs device add /dev/sdc /media/backup

Note1: the filesystem has to be mounted
Note2: the medatada will be in raid1, the data in raid0

Note 3: if the disk has been used (especially under btrfs) you should first delete old partitioning data etc:

        dd if=/dev/zero of=/dev/sdb count=1000
        dd if=/dev/zero of=/dev/sdc count=1000

I've just tried your recipe with two devices I had used for other btrfs experiments:

btrfs filesystem show 2>/dev/null

shows my new wishes, and it shows the old settings too.

But writing 1000 blocks seems to be not enough - sometimes I'll try bigger numbers. What happens with the old (and now unwanted) settings?

By the way: I nee "2>/dev/null" because the actual git version always tries to show all block devices which it finds in "/dev" (no: I don't use "udev").

Viele Gruesse!
Helmut

#12 lore raw
In reply to Goffredo Baroncelli

Hallo, Goffredo,

Du meintest am 20.01.11:

Quoted 7 lines

To add another disk you don't have to run mkfs.btrfs. For example:

# add the first disk
mkfs.btrfs /dev/sdb
# mount the disk
mount /dev/sdb /media/backups
Quoted 5 lines
# add another disk to the first one
btrfs device add /dev/sdc /media/backup

Note1: the filesystem has to be mounted
Note2: the medatada will be in raid1, the data in raid0

I've just tried ...

creating /dev/sde with 2 TByte
adding /dev/sdf with 60 GByte (it's easier to check "ENOSPACE" with such a small device)

copying 94 Gbyte

and then

btrfs filesystem balance /mnt/btr

(needed about 40 minutes for 94 GByte)
leads to

# btrfs filesystem show
Label: none  uuid: 121ae2ed-f572-43e6-8855-cd66ad534401
	Total devices 2 FS bytes used 94.68GB
	devid    2 size 37.27GB used 37.00GB path /dev/sdf
	devid    1 size 1.82TB used 63.04GB path /dev/sde

Label: 'MM2' uuid: ad7c0668-316c-4a79-ba00-3b505b9d99b4
Total devices 2 FS bytes used 1.15TB
devid 1 size 1.81TB used 591.14GB path /dev/sde2
*** Some devices missing

Btrfs Btrfs v0.19

# btrfs filesystem df /mnt/btr
Data, RAID0: total=4.00GB, used=2.00GB
Data: total=94.01GB, used=92.58GB
System, DUP: total=8.00MB, used=16.00KB
System: total=4.00MB, used=0.00
Metadata, DUP: total=1.00GB, used=111.87MB
Metadata: total=8.00MB, used=0.00
# df -t btrfs
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/sde     btrfs   1992597264  99396500 1891304076   5% /mnt/btr
# fdisk -l
# btrfs filesystem show
Label: none  uuid: 121ae2ed-f572-43e6-8855-cd66ad534401
	Total devices 2 FS bytes used 93.68GB
	devid    2 size 37.27GB used 36.12GB path /dev/sdf
	devid    1 size 1.82TB used 93.16GB path /dev/sde

Label: 'MM2' uuid: ad7c0668-316c-4a79-ba00-3b505b9d99b4
Total devices 2 FS bytes used 1.15TB
devid 1 size 1.81TB used 591.14GB path /dev/sde2
*** Some devices missing

Btrfs Btrfs v0.19

# btrfs filesystem df /mnt/btr
Data, RAID0: total=64.00GB, used=31.90GB
Data: total=63.01GB, used=61.67GB
System, DUP: total=8.00MB, used=20.00KB
System: total=4.00MB, used=0.00
Metadata, RAID1: total=128.00MB, used=104.71MB
Metadata, DUP: total=1.00GB, used=6.15MB
Metadata: total=8.00MB, used=0.00
# df -t btrfs
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/dev/sde     btrfs   1992597264  98348716 1892087652   5% /mnt/btr

# -----------------------------------------

Look especially to "btrfs filesystem df /mnt/btr", it shows

Data, RAID0: total=64.00GB, used=31.90GB
Data: total=63.01GB, used=61.67GB

and that will lead to "no space left on device ...".

Viele Gruesse!
Helmut

author
#13 lore raw
In reply to Carl Cook

I must have done something wrong because for the past week or so, almost none of my questions have been answered here. I'm pretty much in trouble now because I have -no- backups, as I cannot get my backup server running, as I've put all my eggs in the btrfs basket. Am I asking things wrong, or am I supposed to be asking somewhere else?

Quoted 34 lines · On Thu 20 January 2011 13:18:40 Carl Cook wrote:

Well I've just tried to add a disk to another, but it fails. I created the first (starting with no traditional partitions) with:

# mkfs.btrfs /dev/sdb

Then I mounted it to /media/backups and put lots of files on it. I shut down the system, added another disk. Set it up with:

# mkfs.btrfs /dev/sdc
WARNING! - Btrfs Btrfs v0.19 IS EXPERIMENTAL
WARNING! - see http://btrfs.wiki.kernel.org before using
fs created label (null) on /dev/sdc
        nodesize 4096 leafsize 4096 sectorsize 4096 size 1.82TB
Btrfs Btrfs v0.19
# btrfs device scan
Scanning for Btrfs filesystems
#
(... Nothing?  Not even my known mounted sdb drive?)
# btrfs device add /dev/sdc /media/backups
ERROR: error adding the device '/dev/sdc'

It gives no clue as to what might possibly be the problem. I want raid0.

Also I can not understand this:
"Note: While subvolumes can be created anywhere in the filesystem tree, in order to be mounted by name a subvolume or snapshot must be in the root of the btrfs filesystem."

I want to do this, but do not know what this means. Tentatively I've created a BTRFS volume and mounted it on /media/backups. I then created subvolumes as backup-hex, backup-droog, snaps-hex and snaps-droog. When I created a snapshot it created a subdir under snaps-hex called hex-root.

It won't allow me to remove snapshots. (Debian Testing)

Also does anyone know how to create a shapshot with the current date in the name? --
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