Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

BTRFS on root and home partiton w/ swap

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
donarntz
Posts: 31
Joined: 2013-03-02 20:26
Location: Austin, TX

BTRFS on root and home partiton w/ swap

#1 Post by donarntz »

I'm a little confused about using swap with btrfs on my home and root partition. I would like to be able to use swap. I know that btrfs can not use swap, but is that only if I create a btrfs drive with volumes? What if I install btrfs on partitions instead? Or would doing so pretty much negate the benefit of using btrfs in the first place? Also, what would be the recommended sizes for btrfs partitions? I have a 120g ssd.

Thanks for the help,

Don

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: BTRFS on root and home partiton w/ swap

#2 Post by pylkko »

You can partition the drive so that there is a swap partition and a btrfs one. Then install to subvolumes on the btrfs. This means that all the other "traditional partitions" are subvolumes now (home, root, var whatever). Subvolumes are way more flexible than real partitions. Yet you have a swap partition just like in ext4 setups.

The only benefit that would come from not doing this is that on some machines you might be able to throw away the partition table and install on one large btrfs. That is, no partitions, no partition table. The machine needs to have an old school BIOS (not UEFI) and even then not all of them work. But obviously in that case, you cannot have other partitions (and therefore swap).

donarntz
Posts: 31
Joined: 2013-03-02 20:26
Location: Austin, TX

Re: BTRFS on root and home partiton w/ swap

#3 Post by donarntz »

Will the debian 9 install do this for me? Also, will 30g root be large enough?

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: BTRFS on root and home partiton w/ swap

#4 Post by pylkko »

I am not sure about the Debian installer. I hope that by now it does btrfs, but I have not tried. The size does not matter. That is one of the nice things about these newer filesystems. Because on btrfs you can resize the subvolumes as you need (it will also grow it automatically for you if you need space). So if your home subvolume has extra space, the root subvolume can use it if it needs. Even if you use the entire disk, you can just add another disk and add that to the old btrfs and it will work as if you had moved the data to one larger disk.

But, yes, on a standard home desktop use kind of machine, with 128 GB as you say, I think you would be safe with 30 GB, even 20 GB. Just make two subvolumes with 20 GB for home and root for example (use 100 GB for the btrfs partition), a swap partition and perhaps another partition (XFS/EXT4/F2FS) for data types that do not like COW if you use them (for example virtual machine images).

donarntz
Posts: 31
Joined: 2013-03-02 20:26
Location: Austin, TX

Re: BTRFS on root and home partiton w/ swap

#5 Post by donarntz »

I ended up installing btrfs on two partitions. Debian installer doesn't do subvolumes and I just go tired of trying to figure out how to do it. Maybe later when it is more simple or the installer does it for me.

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: BTRFS on root and home partiton w/ swap

#6 Post by pylkko »

You can probably fix that very easily by just creating subvolumes within one of the partitions and then snapshotting the contents of the partitions into the subvolumes. Then you can remove the remaining partition.

Probably it would be possible to preformat the drive and install to that, if/since the installer does not understand subcolumes

donarntz
Posts: 31
Joined: 2013-03-02 20:26
Location: Austin, TX

Re: BTRFS on root and home partiton w/ swap

#7 Post by donarntz »

Yes but I would need an easy to read step by step for all of that. I have no experience with btrfs or snapshots at this time. I will keep that in mind though for the future. Thanks so much for your help!

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: BTRFS on root and home partiton w/ swap

#8 Post by GarryRicketson »

I don't know anything about BTRFS either, but I do have some suggestions,
what I do when I try something new to me, and know nothing about it.
But also this is confusing:
I would like to be able to use swap. I know that btrfs can not use swap, but is that only if I create a btrfs drive with volumes?
How do you know this ? if
I have no experience with btrfs or snapshots at this time.
But if you know that for sure,then you know more then I do, however that would make me decide to not use btrfs, if I felt I had to have a swap partition, and knew I could not do that
using btrfs.
Is there any type of partitioning you are familiar with ?
Any way, this is what I would do :
  • Step 1:
    Step by step how to have BTRFS on root and home partition w/ swap, on a Debian system
    ===========
    Step 2.
    Try some of the many results.
    =====================
    Step 3.
    If you do find that it is true, on not being able to have a swap partiton, then decide
    which is more important, using BTRFS, or having the swap partition.
    =================================================
    Step 4.
    After you have read the documentation available, which does include some step by step
    explanations, and have explored the various methods and alternatives, if you are having
    trouble with any particular part, or step, feel free to ask here, but be sure to give details
    on what you actually have done, ...
donarntz wrote:I ended up installing btrfs on two partitions. Debian installer doesn't do subvolumes and I just go tired of trying to figure out how to do it. Maybe later when it is more simple or the installer does it for me.
Do you all ready have Debian 9 installed and working ?
If not then you need to read this first, carefully:
https://debian-handbook.info/browse/sta ... steps.html
Post by donarntz » 2017-07-18 14:15
Yes but I would need an easy to read step by step for all of that.
Most of the documentation and manuals are pretty easy to read, but that is relative and depends on the users reading skills and technical back ground.
We have a few here that do not seem to be able to read anything.
Unfortunately in this case , I do not see any "youtude videos" in the search results, I don't usually suggest them any way, because it simply is not a good method .
If there is some thing wrong with your browser and search engine, and you can not
find any of the many results I see, that is ok, let me know and I will post some links to
some of them.
Sorry I couldn't be of more help.

donarntz
Posts: 31
Joined: 2013-03-02 20:26
Location: Austin, TX

Re: BTRFS on root and home partiton w/ swap

#9 Post by donarntz »

Browser seems to work, since I am able to post this. Them there browsers used to be much better when they analog though. I accept your apology.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: BTRFS on root and home partiton w/ swap

#10 Post by GarryRicketson »

Of course, the searching, etc,...well I know, it can be a real pain,... in any event
you might stumble on to answers to some of the questions, and even find that
solution, it is something you can do in the meantime, while waiting for a better,
more detailed answer... good luck.
---- off topic----
Interesting , Austin , Tx. , when I was still working, and going back and forth from here
to US, I all ways went through Austin, ... pretty country , ...

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: BTRFS on root and home partiton w/ swap

#11 Post by pylkko »

Just to clear some of the confusion here, btrfs does not support swap files, intentionally/by design. It does support having a swap partition or any other partitions on the same drive,just like ext4. Actually, the btrfs code base is based on ext4 just adding some features that are taken from an old BSD fs called zfs. Ok, there are some technical and license differences but these are not relevant here
https://btrfs.wiki.kernel.org/index.php ... p_files.3F

donarntz
Posts: 31
Joined: 2013-03-02 20:26
Location: Austin, TX

Re: BTRFS on root and home partiton w/ swap

#12 Post by donarntz »

Being a novice that was what I was unclear about (swap file unuseable regardless of partition). About the install, unless I am corrected I don't think it detects subvolumes... which is unfortunate for a layperson like myself.

Post Reply