Fedora Linux Support Community & Resources Center
  #1  
Old 4th January 2017, 05:19 AM
stratacast1 Online
Registered User
 
Join Date: Apr 2014
Location: Washington
Posts: 188
linuxfirefox
Move btrfs subvolume to new drive help

My entire /home directory is on a btrfs subvolume, and I'm trying to move it from a 1TB HDD to a 2TB HDD. I have done stuff like this before on EXT4, but I know btrfs works differently with its subvolumes. So here's my thought, and please correct my errors:

1. Plug in the new drive (assume from here current /home is on /dev/sdc and new drive is /dev/sdd)
2. mkfs.btrfs /dev/sdd (new btrfs filesystem on new drive)
3. mv /home /old_home (and make that edit to /etc/fstab)
4. mount /dev/sdd1 /home (I'm not sure if this is technically how btrfs would work)
5. Here there should be some btrfs send ... | btrfs receive ...

Then somewhere in there I just change the UUID in /etc/fstab to my new drive on /home and my new drive should have /home and my old drive be unused, so I can shut down my computer and unplug my old drive. I'm part way there, but I'm missing some detail in how to do this job
Reply With Quote
  #2  
Old 7th January 2017, 01:36 AM
stratacast1 Online
Registered User
 
Join Date: Apr 2014
Location: Washington
Posts: 188
linuxfirefox
Re: Move btrfs subvolume to new drive help

How about this....

Add the HDD, do a mirror and then remove the old HDD from the mirror once the new drive has everything written to it?
Reply With Quote
  #3  
Old 9th January 2017, 06:33 AM
stratacast1 Online
Registered User
 
Join Date: Apr 2014
Location: Washington
Posts: 188
linuxfirefox
Re: Move btrfs subvolume to new drive help

Nothing huh? Seems most people know little about filesystems (including myself here)..I'll risk my computer and report back then. Hopefully it'll help people later.
Reply With Quote
  #4  
Old 9th January 2017, 10:49 AM
Dutchy Offline
Registered User
 
Join Date: Aug 2011
Location: ~
Posts: 1,788
linuxfedorafirefox
Re: Move btrfs subvolume to new drive help

There are multiple ways to do it. Send/receive seems to be the btrfs way, btrfs mirroring is also an option but seems a bit convoluted and disk cloning would take quite a bit of extra time. Besides that you could also just keep it simple and cp or rsync your home to the new drive after you create the btrfs file system and subvolume (you would need to use the right flags and there are some caveats). However you do it you should probably do this as root (user logged out) and then just make the changes in fstab if the fs handle changes.
Reply With Quote
  #5  
Old 9th January 2017, 07:31 PM
ndc333 Offline
Registered User
 
Join Date: Dec 2016
Location: United Kingdom
Posts: 5
linuxchrome
Re: Move btrfs subvolume to new drive help

thinking aloud. why not just use the btrfs pool ie -> btrfs device add ; btrfs balance ; btrfs delete the old drive! then add the new uuid to fstab ; mount -a (btrfs is like the terminator 2 -> it just speads the fs over any storage media you tell it to) look up the add and delete commands.
Reply With Quote
  #6  
Old Today, 06:47 PM
stratacast1 Online
Registered User
 
Join Date: Apr 2014
Location: Washington
Posts: 188
linuxfirefox
Re: Move btrfs subvolume to new drive help

Sorry for getting to this late, but the bug going around got the best of me! I just finished my process last night and it works very well. My old btrfs volume was /dev/sdc1 and my new disk was /dev/sda:

btrfs replace start /dev/sdc1 /dev/sda /home
*Wait for the job to complete and reboot when finished
*Resize the btrfs pool to fill the entire device
btrfs filesystem resize max /dev/sda

Then it's done! What's cool is btrfs replace also edits the /etc/fstab file with the new, proper drive
Reply With Quote
Reply

Tags
btrfs, drive, subvolume

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does a BTRFS Drive Need a BTRFS Backup Drive? joncr Using Fedora 5 15th February 2014 09:32 PM
F19: Can't mount btrfs file system - dmsg='btrfs: superblock checksum mismatch' mmmmm Guides & Solutions (Not For Questions) 2 18th September 2013 10:29 PM
Best way to install to subvolume of already existing BTRFS filesystem? Azendale Installation, Upgrades and Live Media 0 8th November 2011 07:06 PM
BTRFS Subvolume of Home? Timberbrook Using Fedora 5 6th November 2011 02:20 PM
btrfs - add RAID1 partition to existing encrypted btrfs parition techmum Using Fedora 0 4th July 2011 01:21 AM


Current GMT-time: 21:22 (Tuesday, 17-01-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat