Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Which filesystem on an SSD?
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
keba
Guru
Guru


Joined: 02 Jun 2006
Posts: 304
Location: Switzerland

PostPosted: Wed Oct 31, 2012 12:14 am    Post subject: Which filesystem on an SSD? Reply with quote

Hi,

I'm upgrading my laptop's HD to an SSD. Now I was wondering which filesystem would be best suited. Having read a few articles on the web, it seems the only choice really is Ext4 vs Btrfs. So my questions are:
1) Does it make a difference which one?
2) Is Btrfs still "dangerous" to use, i.e. how high is the risk of data loss after a system crash / power loss?
3) Can Btrfs be aligned to the block size? Is that even necessary?
4) Do I need a GPT or is the normal partition table ok?
Note: I'll perform a fresh install...

Thanks in advance
keba
_________________
Prayer can change the world!
Back to top
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Wed Oct 31, 2012 1:05 am    Post subject: Re: Which filesystem on an SSD? Reply with quote

keba wrote:
Hi,
1) Does it make a difference which one?
2) Is Btrfs still "dangerous" to use, i.e. how high is the risk of data loss after a system crash / power loss?
3) Can Btrfs be aligned to the block size? Is that even necessary?
4) Do I need a GPT or is the normal partition table ok?
Note: I'll perform a fresh install...

Thanks in advance
keba


1) Btrfs is faster and I recommend that you use the trim(discard param),the SSD stuff and noatime to save your SSD :P and the compress=lzo params.
Use these :

Code:

/dev/sda4      /                btrfs      defaults,noatime,ssd,discard,compress=lzo,subvol=@root 0 1


2) For my concern, I use btrfs for a while now, and I must say this : Backup your stuff once a week on an external HDD and use daily snapshot and you will be safe.

3) Use gdisk to create your partition table and you will be good to go.

4) You can use GPT if you want, but MBR still work. I prefer GPT for some security reason.

5) Finally,use subvolume when you install your Gentoo.

Like this :

[code]
# mkfs.btrfs /dev/sda2
# mount /dev/sda2 /mnt/gentoo -o subvolume=0
# cd /mnt/gentoo
# btrfs subvolume create @root
# cd / && umount /mnt/gentoo
# mount /dev/sda2 /mnt/gentoo -o defaults,noatime,ssd,discard,compress=lzo,subvol=@root

Then install normaly your Gentoo. Note that you btrfs partition need to be mounted with the subvol=@root
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec
Back to top
View user's profile Send private message
keba
Guru
Guru


Joined: 02 Jun 2006
Posts: 304
Location: Switzerland

PostPosted: Wed Oct 31, 2012 1:09 am    Post subject: Reply with quote

Wow thanks! One question: What's the subvolume good for?
_________________
Prayer can change the world!
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2289
Location: Canada

PostPosted: Wed Oct 31, 2012 1:43 am    Post subject: Reply with quote

I use ext2 on my SSD's :)
Back to top
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Wed Oct 31, 2012 2:03 am    Post subject: Reply with quote

Simple, backup your box live my friend without any need to use a LiveCD.

Like this :

You have a subvolume @root already mounted since you are using your Gentoo right now.

Here what you can do to backup your box while you are using it without any corruption.

I assume that /dev/sda2 is your / partition and /dev/sda1 is your /boot
Code:

# mkdir /mnt/disklayout
# mount /boot
# mount /dev/sda2 /mnt/disklayout -o subvolid=0
# cd /mnt/disklayout
# btrfs subvolume snapshot @root @backup
# cd /
# umount /mnt/disklayout


Bang you saved your box.

Notice that the subvolid=0 enable you to see the top level of your btrfs filesystem, so are able to see your subvolume @root and you can backup it :P

And you can use this command later :

/dev/sdb is your external HDD.

Code:

# mount /dev/sdb1 /mnt/backup
# mount /dev/sda2 /mnt/disklayout -o subvol=@backup
# time rsync -aHA --del --force --stats --progress //mnt/disklayout/ /mnt/backup
# umount /mnt/disklayout
# umount /mnt/backup


That's it.
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec


Last edited by d2_racing on Wed Oct 31, 2012 2:51 am; edited 1 time in total
Back to top
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Wed Oct 31, 2012 2:03 am    Post subject: Reply with quote

dmpogo wrote:
I use ext2 on my SSD's :)


Use ext4 with the trim option at least :P
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec
Back to top
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Wed Oct 31, 2012 2:08 am    Post subject: Reply with quote

When you install Gentoo on Btrfs , install it on a subvolume to unleash the power of the subvolume and all the crazy stuff about the cow and snapshot stuff.

Or Chris Mason worked so hard for nothing.
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec
Back to top
View user's profile Send private message
keba
Guru
Guru


Joined: 02 Jun 2006
Posts: 304
Location: Switzerland

PostPosted: Wed Oct 31, 2012 2:45 am    Post subject: Reply with quote

Cool, thanks for that. But... I still don't understand what a subvolume actually is (forgive my ignorance). Can't I just create a normal / partition, and then a /home and a swap one?
_________________
Prayer can change the world!
Back to top
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Wed Oct 31, 2012 2:54 am    Post subject: Reply with quote

Yes you can, but if you use btrfs and you want to snapshot your box, you need to install all the Gentoo files inside a subvolume.

Exemple :

/dev/sda2 / with the subvolume @root
/dev/sda3 /home with the subvolume @home
/dev/sda4 swap.

You can install your Gentoo box without any subvolume on your btrfs partition, but you will pass by a big feature that is the strenght of Btrfs.
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 2651

PostPosted: Wed Oct 31, 2012 12:37 pm    Post subject: Reply with quote

This is an interesting thread to read, thank you all.

I'm an odd mix of personally conservative, politically liberal, computing liberal, data conservative. So I generally have my data on ext4. (and my MythTV on xfs) But I've been keeping an eye on btrfs, and it's looking "about ready" to me. In the past Phoronix has had benchmarks showing btrfs to be somewhat "peaky" - some it's very good at and some very poor. But last I saw that seems to be leveling out. Plus from what I understand, an fsck.btrfs is available, and presumably maturing. While writing this post I did a little googling around, and perhaps it's time to convert-in-place on my "experimental" system.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Thu Nov 01, 2012 12:58 am    Post subject: Reply with quote

And a lot of good stuff is inside kernel 3.7.

I'm gonna try it sooner or later :P
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2289
Location: Canada

PostPosted: Thu Nov 01, 2012 12:59 am    Post subject: Reply with quote

d2_racing wrote:
dmpogo wrote:
I use ext2 on my SSD's :)


Use ext4 with the trim option at least :P


I don't usually use ext4, and my SSD's are old and do not support TRIM. BTW, them being 4 years old,
I have not yet run into problem of degrading performace/capacity from too many writes.
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 2651

PostPosted: Thu Nov 01, 2012 1:05 am    Post subject: Reply with quote

d2_racing wrote:
And a lot of good stuff is inside kernel 3.7.

I'm gonna try it sooner or later :P


Built 3.6.4-gentoo tonight, and set the btrfs options. Haven't done anything real yet, but now it's a possibility.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2454
Location: Silver City, NM

PostPosted: Thu Nov 01, 2012 3:57 am    Post subject: Reply with quote

depontius wrote:
I'm an odd mix of personally conservative, politically liberal, computing liberal, data conservative.
Does not seem odd to me.
Back to top
View user's profile Send private message
keba
Guru
Guru


Joined: 02 Jun 2006
Posts: 304
Location: Switzerland

PostPosted: Thu Nov 01, 2012 8:14 am    Post subject: Reply with quote

I've just found this, on the Arch Linux Wiki, which explains a bit of what the subvolumes actually are:
Quote:
One of the features of btrfs is the use of subvolumes. Subvolumes are basically a named btree that holds files and directories. They have inodes inside the tree of tree roots and can have non-root owners and groups. Subvolumes can optionally be given a quota of blocks. All of the blocks and file extents inside of subvolumes are reference counted to allow snapshotting. Similar to the dynamically expanding storage of a virtual machine that will only use as much space on a device as needed. Eliminating several half-filled partitions. One can also mount the subvolumes with different mount options giving more flexibility in security.

Especially interesting, is the part about compression:
Quote:

Btrfs supports transparent compression, which means every file on the partition is automatically compressed. This does not only reduce the size of those files, but also improves performance, in particular if using the lzo algorithm.

_________________
Prayer can change the world!
Back to top
View user's profile Send private message
keba
Guru
Guru


Joined: 02 Jun 2006
Posts: 304
Location: Switzerland

PostPosted: Thu Nov 01, 2012 8:15 am    Post subject: Reply with quote

Am I right to assume the following?
1) The FS seems mature enough not to consider it as "dangerous" (as in data loss), as of kernel >=3.6
2) the best option seems to be to create 1 partition with several subvolumes for / and /home and /whatever, and 1 partition for swap.
3) Use lzo-compressionfor improved performance (and disk space)

Is that right?
_________________
Prayer can change the world!
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 2651

PostPosted: Thu Nov 01, 2012 12:58 pm    Post subject: Reply with quote

keba wrote:
Am I right to assume the following?
1) The FS seems mature enough not to consider it as "dangerous" (as in data loss), as of kernel >=3.6
2) the best option seems to be to create 1 partition with several subvolumes for / and /home and /whatever, and 1 partition for swap.
3) Use lzo-compressionfor improved performance (and disk space)

Is that right?


I'm a little stuck here, too. Last night on my experimental system I added btrfs support when I built 3.6.4-gentoo, and later emerged btrfs-progs. The option is now open, though I don't know if I'll actually exercise it until 3.7 is out.

But the more I read, the more it looks like simply converting partition(s) from ext4 to btrfs isn't the best way to go about it. My attitude toward partitioning has changed over the years, as filesystems have gotten better. Right now I have boot, root, local (non-nfs home), swap, and 2 cache partitions. (one for afs and one for cachefilesd) Seems to me that in an optimized setup, I'd move root and local to 2 subvolumes of a single btrfs partition. The afs cache is on ext2 - it doesn't even like being on a journaled filesystem, though I wish I could remember how to do a non-journaled ext4. I have no idea how cachefilesd would feel about btrfs, right now it's on ext4 and needs xattrs.

The better way would be to get a portable drive, back up, and repartition. But the fast way would be to simply convert-in-place. Heck, I should back up anyway, and I can always repartition.

I'll see what happens after I finish procrastinating.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
tr0ll
Tux's lil' helper
Tux's lil' helper


Joined: 14 Aug 2010
Posts: 92
Location: varies

PostPosted: Thu Nov 01, 2012 7:04 pm    Post subject: Reply with quote

dmpogo wrote:
I use ext2 on my SSD's :)


that just made my day .. awesome.
Back to top
View user's profile Send private message
keba
Guru
Guru


Joined: 02 Jun 2006
Posts: 304
Location: Switzerland

PostPosted: Fri Nov 02, 2012 11:00 am    Post subject: Reply with quote

So I'm testing Btrfs in an image file. It seems amazing, especially the subvolume feature. Thanks so much for your help, d2_racing!!!

For anyone curious about what I'm doing (Note: this is on a regular HDD):
Code:

# Create a 10GB empty image file.
dd if=/dev/zero of=/partition.img bs=1MiB count=10000
mkfs.btrfs /partition.img
mount -o loop /partition.img /directory/
cd /directory/
btrfs subvolume create @root
cd /
umount /directory/
mount /partition.img /directory -o loop,defaults,compress=lzo, subvol=@root
cd /directory/
# Now start gentoo installation


I'm hoping to install gentoo like this, inside the image. And then, when everything is done, I'll transfer my main @root to the SSD and have a nice and running system, without having all the writes on the SSD while compiling my system.
BTW, is it still true that having too many writes on an SSD will compromise it, i.e. will a modern SSD wear down easily with gentoo because of the compilation?
_________________
Prayer can change the world!
Back to top
View user's profile Send private message
tr0ll
Tux's lil' helper
Tux's lil' helper


Joined: 14 Aug 2010
Posts: 92
Location: varies

PostPosted: Fri Nov 02, 2012 11:28 am    Post subject: Reply with quote

would love to see this with encryption.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2289
Location: Canada

PostPosted: Fri Nov 02, 2012 3:51 pm    Post subject: Reply with quote

keba wrote:

BTW, is it still true that having too many writes on an SSD will compromise it, i.e. will a modern SSD wear down easily with gentoo because of the compilation?


Well, just do compilations in tmpfs. I have 4 year old SSD in my laptop, one of the first generation of Samsungs, and it is still fine (of course it maybe one day away from failure, knock-knock)
Back to top
View user's profile Send private message
keba
Guru
Guru


Joined: 02 Jun 2006
Posts: 304
Location: Switzerland

PostPosted: Fri Nov 02, 2012 10:30 pm    Post subject: Reply with quote

Sounds good, I'll try that. Thanks.

Oh, and do I need a /boot partition, or does it work if I have the /boot directory in @root on the main partition? I'm using Grub2.
_________________
Prayer can change the world!
Back to top
View user's profile Send private message
d2_racing
Moderator
Moderator


Joined: 25 Apr 2005
Posts: 13046
Location: Ste-Foy,Canada

PostPosted: Sat Nov 03, 2012 12:52 am    Post subject: Reply with quote

You should use a separate /boot partition just to be safe.
_________________
Sysadmin of GentooQuébec.org
Wiki
Signature
IRC on Freenode : #gentoo-quebec
Back to top
View user's profile Send private message
Dieter.Soltau
n00b
n00b


Joined: 27 Nov 2011
Posts: 68

PostPosted: Thu Nov 08, 2012 2:18 pm    Post subject: Reply with quote

lzo compression? but doesn't that cost extra time? well dunno, i would not compress data on my SSD because the speed is what the drive is for..
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 2651

PostPosted: Thu Nov 08, 2012 3:41 pm    Post subject: Reply with quote

Dieter.Soltau wrote:
lzo compression? but doesn't that cost extra time? well dunno, i would not compress data on my SSD because the speed is what the drive is for..


It wouldn't necessarily cost any speed, even on an SSD. Using LZO compression costs decompression time, but you have to balance that against rotational and track latency on a spinning drive, and channel transfer speed on either spinning or SS drive. Conditions for a win on compression are stiffer, but I presume possible..
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum