Wierd partition behaviour with BTRFS

Patrick O'Callaghan pocallaghan at gmail.com
Fri Mar 14 00:41:40 UTC 2014


On Thu, 2014-03-13 at 14:57 -0600, Chris Murphy wrote:
> On Mar 13, 2014, at 4:56 AM, Patrick O'Callaghan <pocallaghan at gmail.com> wrote:
> > 
> > $ sudo btrfs fi df /
> > ERROR: couldn't get space info - Inappropriate ioctl for device
> > ERROR: get_df failed Inappropriate ioctl for device
> 
> Right that should have been /home but you already provided that info.
> >> 
> >> So if yours is configured this way, it's probably not critical to change it. The metadata going to the SSD isn't much, and since the HDD has much more space probably all data chunks are allocated on it for the near/medium term. But conversion to single device Btrfs is straightforward, three btrfs commands will do it. And then some extras to reclaim the space on the SSD for /var or / or whatever.
> > 
> > I'm willing to try it if you give me step-by-step instructions. I have
> > daily backups on a NAS so I can recover from disasters.
> 
> Based on your lsblk -fs results, /dev/sda1 is /boot and there's probably no point in growing it by 4GB which is the size of /dev/sda2 the btrfs /home. Gparted has a way to first move a volume then resize it. It appears as a single operation in the UI. But this is what you'd need to do to use this extra space for what's currently /dev/sda3, root.

Agreed.

> If the SSD dies, most of the /home data is on the HDD, and since the file system is raid1, the btrfs volume will still work if mounted with -o degraded. Any broken files (partly or fully on the SSD) will return an error - it's not like you'll get corrupted data returned by the file system.
> 
> So really it's up to you. But first, the way to get back to a single device Btrfs /home is:
> 
> btrfs balance start -mconvert=single /home --force
> btrfs device delete /dev/sda2 /home
> btrfs balance start -mconvert=dup /home
> 
> 1. Converts metadata from raid1 to single copy, which requires force since redundancy is reduced.
> 2. Migrates any data/metadata from /dev/sda2 and also deletes it from the volume.
> 3. Converts metadata from single copy to duplicate, which is the default for mkfs on HDDs.
> 
> When it's done you can post a new:
> 
> btrfs fi show
> btrfs fi df /home

Done:

$ sudo btrfs fi show
Label: xtra  uuid: 22fecad3-619d-4a9b-aace-35a2e4e04c49
        Total devices 1 FS bytes used 73.73GiB
        devid    2 size 927.32GiB used 79.06GiB path /dev/sdb1

Btrfs v3.12
$ sudo btrfs fi df /home
Data, single: total=78.00GiB, used=73.45GiB
System, DUP: total=32.00MiB, used=16.00KiB
Metadata, DUP: total=512.00MiB, used=294.95MiB

> Check to make sure your /etc/fstab  is using UUID for /home and not /dev/sda2 or it will fail to mount. I don't know why but sometimes anaconda is creating fstab entries with /dev/ designations instead of UUIDs. If it is, then you can use blkid to find the volume uuid for /home (not the UUID_SUB or PARTUUID).

It's already using the UUID so hopefully that will work.

Thanks for your help.

poc



More information about the users mailing list