Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have an existing btrfs raid1 volume consisting of 4 disks. This already contains a few subvolumes of which I'm looking to install Ubuntu to one of. I've done the following: mount -o subvolid=0 /dev/sda1 /btrfsroot btrfs subvol create rootsfs /btrfsroot btrfs subvol set-default 376 /btrfsroot mount /dev/sda1 /rootfs (to ensure I've set the correct id)

The installer crashes out after the partitioner though (saying it can't remove needed files from /target/). I've set it to use partition /dev/sda1 as btrfs on / without formatting.

I've done a fair bit of research but at first glance it's hard to tell what the best practice is with regards installing Ubuntu into an existing btrfs subvolume. I've also tried:

  • Not partitioning /dev/sd[a-d] at all and adding those to the btrfs volume. When I install in this manner it kind of works (I have to manually mount /dev/sda to /target/) but then I get stuck at a grub debug shell on reboot
  • Partitioning off 100 meg off (as /dev/sda1) each disk and creating an mdadm array to use as /boot/ (with btrfs partitions as /dev/s[a-d]2). Again the installer crashes after partitioning saying it could not delete needed files from /target/ though nothing is there.

I've read the info here and I'm guessing I'm running into the problems they mention there about set-default breaking Ubuntu's layout. Though my interpretation was that that is only an issue after install - I can't even get that far.

What is the best practice here? My reason for wanting to install onto a separate subvolume is to keep my Ubuntu install distinct from everything else on the drives. Is it safe to do an install into the root-subvolume without risking nuking my data?

share|improve this question
1  
if you want to install Ubuntu on existing btrfs partition, just make sure, that there are no @ and @home subvolumes on it. Those volumes will be created by installer automatically, and you can change their name later (remember to update grub and /etc/fstab !). I've never installed ubuntu on btrfs RAID though. –  Adam Ryczkowski Apr 29 at 16:12
    
I'll give that a go - will it work if I use the whole root of the drive, or do I need a separate ext[34] /boot/ partition? –  JamNCheez Apr 29 at 16:18
    
I've never tested it without separate /boot partition. –  Adam Ryczkowski Apr 29 at 16:41
    
@AdamRyczkowski Please write that into an answer. –  ignis May 3 at 5:42

1 Answer 1

up vote 0 down vote accepted

disclaimer

I've never used btrfs RAID. The solution is tested only on single-volume btrfs root partitions


  1. Make sure, there are no /@ and /@home subvolumes on the candidate for root.

  2. Launch the Ubuntu installer, and choose something else when it asks you about disk partitioning.

  3. Mark your btrfs partition as root filesystem, but don't let the installer reformat it.

  4. Arrange all the other partitions as you like. I always choose to use external /boot partition on gpt systems, so I can later migrate into something more advanced (e.g. bcache) or whatever. (On gpt you can have as many partitions as you want, so I see no real drawback of using dedicated /boot.)

  5. Finish the installation.

The installer will make the @ and @home subvolumes for you. Later you can rename them into something different - just be sure you also update the new name on both /etc/fstab and /boot/grub/grub.cfg.

Tested on Ubuntu 14.04, Mint 16, Mint 15, Ubuntu 13.10 and Ubuntu 13.04.

share|improve this answer
1  
I tried this in a test VM and it worked ok with RAID-1. I'm now in the process of doing it for real, but the btrfs-convert on my 5.6tb array is taking its time. 4 days so far! –  JamNCheez May 4 at 9:24
    
Editing grub.cfg is not recommended. It contains this warning: DO NOT EDIT THIS FILE It is automatically generated by grub-mkconfig using templates from /etc/grub.d and settings from /etc/default/grub. I presume because next kernel update, for example, will overwrite these changes. Is there a better way to rename a subvolume? –  philcolbourn Jun 9 at 0:18
    
@philcolbourn I know it. But empirical evidence tells, that the part of grub.cfg that invokes the kernel and instructs it about the name of the root btrfs subvolume magically survives update-initramfs. –  Adam Ryczkowski Jun 9 at 19:14
    
@Adam, yes I found that out too - hence my edit. –  philcolbourn Jun 10 at 13:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.