I have a laptop I’d like to add an SSD to and would like to know the proper way to set up the partition scheme with BTRFS. Did a couple searches but yielded nothing conclusive.
What schemes are you guys using? How should I set it up in a fresh install of 13.1.
I currently have my desktop running BTRFS but it is just full partitions with BTRFS formatting (root,home,swap) the same way I’d treat EXT4.
Any pointers would be much appreciated.
Hi
Here are mine on two HP ProBook 4440s’s
System 1:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 119.2G 0 disk
├─sda1 8:1 0 260M 0 part /boot/efi
├─sda2 8:2 0 40G 0 part /
├─sda3 8:3 0 71G 0 part /data
└─sda4 8:4 0 8G 0 part [SWAP]
fstab entry;
cat /etc/fstab
/dev/disk/by-id/ata-OCZ-VERTEX4_OCZ-7B81SXCWP5VKVR6X-part4 swap swap defaults 0 0
UUID=bc702ca6-ac81-48ea-8a62-f2d51423553d / btrfs rw,discard,relatime,ssd,space_cache 0 0
/dev/disk/by-id/ata-OCZ-VERTEX4_OCZ-7B81SXCWP5VKVR6X-part1 /boot/efi vfat umask=0002,utf8=true 0 0
/dev/disk/by-id/ata-OCZ-VERTEX4_OCZ-7B81SXCWP5VKVR6X-part3 /data ext4 rw,discard,relatime,data=ordered 1 2
sysctl.conf:
# See https://wiki.archlinux.org/index.php/Solid_State_Drives#Swap_Space_on_SSDs
vm.swappiness=1
vm.vfs_cache_pressure=50
snapper configuration:
cat /etc/snapper/configs/root
# subvolume to snapshot
SUBVOLUME="/"
# filesystem type
FSTYPE="btrfs"
# users and groups allowed to work with config
ALLOW_USERS=""
ALLOW_GROUPS=""
# start comparing pre- and post-snapshot in background after creating
# post-snapshot
BACKGROUND_COMPARISON="yes"
# run daily number cleanup
NUMBER_CLEANUP="yes"
# limit for number cleanup
NUMBER_MIN_AGE="1800"
NUMBER_LIMIT="4"
# create hourly snapshots
TIMELINE_CREATE="yes"
# cleanup hourly snapshots after some time
TIMELINE_CLEANUP="yes"
# limits for timeline cleanup
TIMELINE_MIN_AGE="1800"
TIMELINE_LIMIT_HOURLY="4"
TIMELINE_LIMIT_DAILY="2"
TIMELINE_LIMIT_MONTHLY="1"
TIMELINE_LIMIT_YEARLY="1"
# cleanup empty pre-post-pairs
EMPTY_PRE_POST_CLEANUP="yes"
# limits for empty pre-post-pair cleanup
EMPTY_PRE_POST_MIN_AGE="1800"
System 2:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 111.8G 0 disk
├─sda1 8:1 0 260M 0 part /boot/efi
├─sda2 8:2 0 40G 0 part /
├─sda3 8:3 0 63.5G 0 part /data
└─sda4 8:4 0 8G 0 part [SWAP]
All of the above are the same for system 2 except the ssd is a Crucial M500 120GB device.
When your installing ensure you set /home as a btrfs sub volume with the YaST partitioner expert options. I also add to the bootloader options elevator=noop, there is a new module out called bfq which may be of use;
http://lists.opensuse.org/opensuse-factory/2014-06/msg00002.html
Thanks for the reply. So during install I should create a custom proposal? I had an incident in the past when I chose both btrfs and lvm and was unable to read the data from another install.
Hi
Yes, I just use btrfs for the / nothing else. I do leave my home in the 40GB partition and create softlinks to data on the ext4 partition, hence I make sure it’s excluded from snapshots.
So you install OS to btrfs but home to ext4? Isn’t btrfs made to protect against bitrot? I’d some you’d want btrfs for home and ext4 as external backup.
Checksums for protection against bitrot is one feature of btrfs. Another one is snapshots. With snapshots, taken manually or automatically by cron or zypper, you can restore old file versions or deleted files, but you should be aware, that these snapshots take disk space. This may be an issue on small partitions, for example on a ssd. In my tests openSUSE did configure automatic snapshots per default only for “/” and not for /home.
Hendrik
The SSD is 512GB. I plan on using maybe half of it with my own data, probably less. With BTRFS LVM though, I could resize the Root if needed. If I were setting it up as EXT4 I’d do this:
sda1 - EXT4 - / - 100GB
sda2 - EXT4 - /home - 388GB
swap - 24GB
That’s rough of course. I’m sure my description isn’t technical enough. How would it look as BTRFS? What options would I choose during install? Do I need to check the LVM option if it’s BTRFS? It seems to want to create logical volumes anyway.
Sorry for being noobish here but I’ve never been clear on the ‘right’ way to do it. Thanks for your help.
I guess with 13.1 you manually select btrfs for a partition. I do not know if it is possible to add mount points for individual subvolumes. In Factory (development version of next openSUSE release) installer now has explicit “use btrfs” checkbox at the main partition screen. This creates single btrfs filesystem with many subvolumes by default (/, /boot, /var, etc). You can edit and remove some subvolumes.
Do I need to check the LVM option if it’s BTRFS?
No, you do not really need it, but right now YaST does not support multi-disk btrfs, which would be one reason to use LVM. Another would be full disk encryption, which again is possible only with LVM when setup with YaST.
Ok so I just installed it as BTRFS without LVM or separate /home partition. The thing I don’t like about setting up separate /home partition is that you have to do a whole new proposal from scratch instead of just editing the existing one and resizing the / partition which is too small by default.
Thanks for the replies everyone.
I Like a separate home because you can then reformat or change root any way you want and never touch your personal data. Putting all on the same partitions seems like Windows to me rotfl!
I agree but I also lost a lot of data using the LVM option and doign separate /home means I have to redo the proposal manually.