145d1 ZFS on SSD - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Base System > Storage

Storage Place to ask questions about partitioning, labelling, filesystems, encryption or anything else related to storage area.

Reply
 
Thread Tools Display Modes
  #1  
Old September 4th, 2012, 02:27
kr651129 kr651129 is offline
Member
 
Join Date: Feb 2012
Posts: 290
Thanks: 19
Thanked 3 Times in 3 Posts
Default ZFS on SSD

I recently formatted my SSD to install ZFS on FreeBSD 9 after I ran through the setup on VirtualBox to make sure I knew how to do it. The install on VirtualBox worked fine, using the same guide I installed ZFS after reformatting my drive an it wouldn't boot, it kept telling me that it couldn't find any ZFS pool to boot from. Is there anything special I need to take into account when installing ZFS on a SSD?
Reply With Quote
  #2  
Old September 4th, 2012, 07:49
vermaden's Avatar
vermaden vermaden is offline
Giant Locked
 
Join Date: Nov 2008
Location: pl_PL.lodz
Posts: 2,193
Thanks: 59
Thanked 633 Times in 349 Posts
Default

I use ZFS on SSD from more then a year, works like a charm, I never changed anything specially for SSD.
__________________
Religions, worst damnation of mankind.
"FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM
http://vermaden.blogspot.com
Reply With Quote
  #3  
Old September 4th, 2012, 12:18
avilla@'s Avatar
avilla@ avilla@ is offline
FreeBSD Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 258
Thanks: 8
Thanked 55 Times in 47 Posts
Default

Quote:
Originally Posted by kr651129 View Post
it kept telling me that it couldn't find any ZFS pool to boot from. Is there anything special I need to take into account when installing ZFS on a SSD?
Be sure not to export the pool before rebooting.
__________________
Alberto Villa, FreeBSD committer <avilla@FreeBSD.org>
http://people.FreeBSD.org/~avilla
Reply With Quote
  #4  
Old September 4th, 2012, 14:32
anton anton is offline
Junior Member
 
Join Date: Sep 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Bear in mind that ZFS doesn't support TRIM yet as far as I'm concerned. This means you should better use an SSD with good background garbage collection, otherwise you'll experience performance degradation as time passes by.
This is what pjd (the man who ported ZFS to FreeBSD) had to say about this:
http://permalink.gmane.org/gmane.os....aris.zfs/44978
Reply With Quote
  #5  
Old September 13th, 2012, 21:43
kr651129 kr651129 is offline
Member
 
Join Date: Feb 2012
Posts: 290
Thanks: 19
Thanked 3 Times in 3 Posts
Default

I can't boot to my zfs install, here is the error I'm getting

Code:
Gptzfsboot: error 1 lba 48
Gptzfsboot: error 1 lba 1
Gptzfsboot: no zfs pools located, can't boot
Reply With Quote
  #6  
Old September 13th, 2012, 23:57
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,724
Thanks: 432
Thanked 1,762 Times in 1,459 Posts
Default

Was that drive partitioned as GPT?
Reply With Quote
  #7  
Old September 14th, 2012, 00:12
kr651129 kr651129 is offline
Member
 
Join Date: Feb 2012
Posts: 290
Thanks: 19
Thanked 3 Times in 3 Posts
Default

I format the drive and create the partitions as follows

Code:
dd if=/dev/zero of=/dev/ada0
gpart create -s gpt ada0
gpart add -b 34 -s 94 -t freebsd-boot ada0
gpart add -t freebsd-zfs -l disk0 ada0
gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0
Reply With Quote
  #8  
Old September 14th, 2012, 07:35
Sebulon's Avatar
Sebulon Sebulon is offline
Member
 
Join Date: Nov 2010
Location: Uppsala, Sweden
Posts: 559
Thanks: 24
Thanked 93 Times in 78 Posts
Default

@kr651129

Maybe a slight modification to the boot partition, I think it looks a little small, and can start right from the beginning, without "-b". And I always set the first data partition aligned to start at 1MiB "-b 2048" and made to end aligned with 4k.

# gpart destroy -F ada0
# gpart add -t freebsd-boot -s 64k ada0
# gpart add -t freebsd-zfs -b 2048 -a 4k -l disk0 ada0
# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada0

Then there are some things you need to have done to make this work, so I typed them up, in case there is something you may have missed. Remember gnop when making the pool to get ashift=12
# gnop create -S 4096 /dev/gpt/disk0

Save your zpool.cache somewhere writeable, if your´re making it from the bsdinstaller:
# zpool create -O mountpoint=none -o cachefile=tmp/zpool.cache rpool gpt/disk0.nop
# zfs create -o mountpoint=legacy rpool/root
# zpool set bootfs=rpool/root rpool

# zpool export rpool
# gnop destroy /dev/gpt/disk0.nop
# zpool import -o cachefile=/tmp/zpool.cache -d /dev/gpt rpool

Copy zpool.cache to /mnt/boot/zfs/.
# mount -t zfs rpool/root /mnt
# mkdir -p /mnt/boot/zfs
# cp /tmp/zpool.cache /mnt/boot/zfs/

And finish off by putting entries in fstab and loader.conf
Code:
# ee /tmp/bsdinstall_etc/fstab
rpool/root              /               zfs   rw  0  0

# ee /mnt/boot/loader.conf
zfs_load="YES"
vfs.root.mountfrom="zfs:rpool/root"
Works for me™

You can of course add filesystems according to your own liking. Just remember to handle their mounts, either with zfs mounting them, or with fstab.

/Sebulon
Reply With Quote
  #9  
Old September 14th, 2012, 09:47
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,724
Thanks: 432
Thanked 1,762 Times in 1,459 Posts
Default

With the data partition starting at 1M, might as well make the freebsd-boot partition as large as possible to avoid having to increase it later if the bootcode gets bigger. At present, that means 512K. Also, it won't hurt to make that partition 4K-aligned, starting at block 40. Probably won't help, either, but the extra space is unused anyway.
# gpart add -t freebsd-boot -b40 -s512k ada0

For FreeBSD 9.1, and 9-stable now:
# gpart add -t freebsd-boot -a4k -s512k ada0

Code:
# gpart show ada0
=>       34  500118125  ada0  GPT  (238G)
         34          6        - free -  (3.0k)
         40       1024     1  freebsd-boot  (512k)
       1064        984        - free -  (492k)
       2048    ...
Reply With Quote
  #10  
Old September 14th, 2012, 10:55
gkontos's Avatar
gkontos gkontos is offline
Senior Member
 
Join Date: Dec 2009
Location: Polidendri, GR
Posts: 1,266
Thanks: 42
Thanked 218 Times in 164 Posts
Default

I think that for a 4K alignment the freebsd-boot partition should be added like this:

# gpart add -b 34 -s 94 -t freebsd-boot adaX

I haven't seen any changes since r230059 but of course I could be wrong.
__________________
Powered by BareBSD
Reply With Quote
  #11  
Old September 14th, 2012, 23:14
kpa kpa is offline
Giant Locked
 
Join Date: Jul 2010
Location: People's Technocratic Republic of Finland
Posts: 2,015
Thanks: 44
Thanked 467 Times in 397 Posts
Default

I see no reason to specify -b for the boot partition, gpart(8) will use the next available sector automatically.

I do recall that there was some talk about -a and -b options conflicting, is that you are referring to? My take on that is that the -a option is a stronger requirement than -b. So if you say:

# gpart add -t freebsd-boot -b 34 -a 4k -s 128k ada0

This should always create a partition that starts from sector 40, the next sector after 34 that is divisible by 8.
Reply With Quote
  #12  
Old September 15th, 2012, 00:36
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,724
Thanks: 432
Thanked 1,762 Times in 1,459 Posts
Default

-a rounds the start and size to even multiples of the value given. Up until a couple of months ago, the -b value was ignored if -a was used. The version of gpart(8) in 9-STABLE now and 9.1-RELEASE has that fixed.

With the fixed version, this command will do as you'd expect, creating a 4K-aligned partition starting a 1M:
# gpart add -t freebsd-ufs -a4k -b 1m -s 20g ada0

The earlier version of gpart(8) would create a 20g aligned partition, but it would start at the next available aligned block.
Reply With Quote
Reply

Thread Tools
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


All times are GMT +1. The time now is 13:40.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0