LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-17-2014, 09:20 AM   #1
vinbob
Member
 
Registered: May 2005
Location: Fareham, UK
Distribution: HP-UX 11i, Fedora, Ubuntu, Debian, RHEL, OEL, CentOS
Posts: 75

Rep: Reputation: 17
Btrfs: Moving a large chuck of data from filesystem to subvolume


Hi,

I've recently converted an ext4 filesystem with 2.5TB of data to btrfs and I would like to have that data, now residing in the root of the filesystem (subvolid 0) in a subvolume so the subvolume can be snapshotted on a regular basis.
I'm new to using Btrfs and I'd like some opinion on the best way to move this data and I haven't found any specific info on standard practice in this situation after the usual flurry of Google searches etc.

So would it be necessary to create a subvolume and move the data from the filesystem to the subvolume? aka;

Code:
# btrfs subvolume create /mnt/subvol1
# mv /mnt/dir1 /mnt/dir2 /mnt/dir3 /mnt/subvol1/
... which will take ages.


Or is it just as valid to create a rw snapshot, delete the data above the snapshot path, and use that subvolume as my data filesystem going forward, aka;

Code:
# btrfs subvolume snapshot /mnt /mnt/subvol1
# rm -rf /mnt/dir1 /mnt/dir2 /mnt/dir3
# umount /mnt
# mount -o subvol=subvol1 /dev/sdb /mnt
... which will take no time at all.


Opinions?

Thanks in advance.

Last edited by vinbob; 09-17-2014 at 10:40 AM.
 
Old 09-18-2014, 04:42 AM   #2
vinbob
Member
 
Registered: May 2005
Location: Fareham, UK
Distribution: HP-UX 11i, Fedora, Ubuntu, Debian, RHEL, OEL, CentOS
Posts: 75

Original Poster
Rep: Reputation: 17
Well I got some advice on the btrfs IRC and indeed there is no point doing a mv from the filesystem's root path to a subvolume. There is no issue with doing that, however on btrfs it'll take as long as it takes to move full copies of th files as if moving between two physical devices (in my situation 2.5TB).

There is also no issue with creating a snapshot subvolume and deleting the originals but after advice I ended up just creating a subvolume and reflink copies of the data in the new subvolume. This completes quickly and doesn't use any extra disk space, I could then delete the original data.

For anyone else who may be questioning how this should be done, here's what I did;

Code:
# cd /mnt  # (/mnt being my btrfs filesystem root in this example)
# btrfs subvolume create subvol1
# cp -pr --reflink=always dir1 dir2 dir3 subvol1/
# rm -rf dir1 dir2 dir3
Simple as that, then I could mount the subvolume as the default subvolume and I can begin to take regular in-line snapshots of it and any other subvolumes I choose to create.

Last edited by vinbob; 09-18-2014 at 05:52 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
btrfs filesystem df /mnt/btrfs/ shows bothe data and metdata with raid1 and single. gonus Linux - Software 3 07-17-2014 02:48 PM
[SOLVED] Moving large amount of data to another drive Quads Linux - Newbie 6 03-04-2014 02:59 PM
[SOLVED] Btrfs as a filesystem type option during install? pupok Slackware - Installation 4 06-10-2012 06:15 PM
btrfs subvolume quota phil.d.g Linux - Software 0 08-29-2011 12:18 AM
[SOLVED] Question about BtrFS filesystem compression. silvyus_06 Linux - Newbie 2 02-09-2011 12:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration