Re: Move data and mount point to subvolume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/09/18, Chris Murphy (lists@xxxxxxxxxxxxxxxxx) wrote:
> > So I did this:
> >
> >     btrfs subvol snapshot /bkp /bkp/backup-subvol
> >
> > strangely while /bkp/backup has lots of files in it,
> > /bkp/backup-subvol/backup has none.
> >
> > # btrfs subvol list /bkp
> > ID 258 gen 313585 top level 5 path backup
> > ID 4782 gen 313590 top level 5 path backup-subvol
> 
> OK so previously you said "/bkp which is a top level subvolume. There
> are no other subvolumes."
> 
> But in fact backup is already a subvolume. So now it's confusing what
> you were asking for in the first place, maybe you didn't realize
> backup is not a dir but it is a subvolume.

Thanks very much for spotting my error, Chris.

    # mount | grep bkp
    /dev/mapper/cdisk2 on /bkp type btrfs
    (rw,noatime,compress=lzo,space_cache,subvolid=5,subvol=/)

    # btrfs subvol list /bkp
    ID 258 gen 313636 top level 5 path backup

I'm a bit confused about the difference between / and backup, which is
at /bkp/backup.

Anyhow I've verified I can snapshot /bkp/backup to another subvolume.
This means I don't need to move anything, simply remount /bkp at
/bkp/backup.

Presumably I can therefore remount /bkp at subvolume /backup? 

# btrfs subvolume show /bkp/backup | egrep -i 'name|uuid|subvol'
        Name:                   backup
        UUID:                   d17cf2ca-a6db-ca43-8054-1fd76533e84b
        Parent UUID:            -
        Received UUID:          -
        Subvolume ID:           258

My fstab is presently

    UUID=da90602a-b98e-4f0b-959a-ce431ac0cdfa /bkp  btrfs  noauto,noatime,compress=lzo 0  2

I guess it would now be

    UUID=d17cf2ca-a6db-ca43-8054-1fd76533e84b /bkp  btrfs  noauto,noatime,compress=lzo 0  2

> If you snapshot a subvolume, which itself contains subvolumes, the
> nested subvolumes are not snapshot. In the snapshot, the nested
> subvolumes are empty directories.
> 
> >
> > # btrfs fi du -s /bkp/backup-subvol/backup
> >      Total   Exclusive  Set shared  Filename
> > ERROR: cannot check space of '/bkp/backup-subvol/backup': Inappropriate
> > ioctl for device
> 
> That's a bug in older btrfs-progs. It's been fixed, but I'm not sure
> what version, maybe by 4.14?

Sounds about right -- my version is 4.7.3.

> > Any ideas about what could be going on?
> >
> > In the mean time I'm trying:
> >
> >     btrfs subvol create /bkp/backup-subvol
> >     cp -prv --reflink=always /bkp/backup/* /bkp/backup-subvol/
> 
> Yeah that will take a lot of writes that are not necessary, now that
> you see backup is a subvolume already. If you want a copy of it, just
> snapshot it.

Makes sense.

Thanks very much
Rory



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux