显示标签为“FreeBSD”的博文。显示所有博文
显示标签为“FreeBSD”的博文。显示所有博文

2013年1月19日星期六

Fix external SSD file system on Mac OS X

I use Retina MacBook Pro, the internal SSD capacity is 256G, no enough for me.
so I usual attach a usb SSD driver, usb 3.0 speed is very good for SSD, but the SSD driver file system crash 
three times.

some time can you Disk Utility.app  fix it, but today ,the tool give me
rMBP:~ yarshure$ sudo fsck_hfs -ry  /dev/disk1s2
** /dev/rdisk1s2
   Executing fsck_hfs (version diskdev_cmds-557.3~1).
** Checking Journaled HFS Plus volume.
   The volume name is VM
** Checking extents overflow file.
** Checking catalog file.
** Rebuilding catalog B-tree.
** Rechecking volume.
** Checking Journaled HFS Plus volume.
   The volume name is VM
** Checking extents overflow file.
** Checking catalog file.
   Incorrect number of thread records
(4, 220)
** Checking multi-linked files.
** Checking catalog hierarchy.
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
** Repairing volume.
** Rechecking volume.
** Checking Journaled HFS Plus volume.
   The volume name is VM
** Checking extents overflow file.
** Checking catalog file.
   Incorrect number of thread records
(4, 220)
** Checking multi-linked files.
** Checking catalog hierarchy.
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
** Repairing volume.
** Rechecking volume.
** Checking Journaled HFS Plus volume.
   The volume name is VM
** Checking extents overflow file.
** Checking catalog file.
   Incorrect number of thread records
(4, 220)
** Checking multi-linked files.
** Checking catalog hierarchy.
** Checking extended attributes file.
** Checking volume bitmap.
** Checking volume information.
** The volume VM could not be repaired after 3 attempts.

 the file system too weak, I search the web, found DiskWarrior.app.
It help me fixed the crash system.

2013年1月11日星期五

Practice ZFS on FreeBSD server.


Today,I setup one FreeBSD Server.
use 12*1T SAS Driver.
1 two driver use LSI controller  make RADI1
2 others use zfs
   enable zfs

echo 'zfs_enable="YES"' >> /etc/rc.conf
echo 'zfs_load="YES"' >> /boot/loader.conf

start zfs support
# /etc/rc.d/zfs start
setup gpt partion

    13 9:55 gpart create -s gpt da1
    14 9:55 gpart create -s gpt da2
    15 9:55 gpart create -s gpt da3
    16 9:55 gpart create -s gpt da4
    17 9:55 gpart create -s gpt da5
    18 9:55 gpart create -s gpt da6
    19 9:55 gpart create -s gpt da7
    20 9:55 gpart create -s gpt da8
    21 9:55 gpart create -s gpt da9
    22 9:55 gpart create -s gpt da10
add FreeBSD zfs part ion

    23 9:56 gpart add -t freebsd-zfs -l disk0 da1
    24 9:56 gpart add -t freebsd-zfs -l disk1 da2
    25 9:56 gpart add -t freebsd-zfs -l disk2 da3
    26 9:56 gpart add -t freebsd-zfs -l disk3 da4
    27 9:56 gpart add -t freebsd-zfs -l disk4 da5
    28 9:57 gpart add -t freebsd-zfs -l disk5 da6
    29 9:57 gpart add -t freebsd-zfs -l disk6 da7
    30 9:57 gpart add -t freebsd-zfs -l disk7 da8
    31 9:57 gpart add -t freebsd-zfs -l disk8 da9
    32 9:57 gpart add -t freebsd-zfs -l disk9 da10

create raidz tank use disk8 and disk9 as spare



root@FreeBSD-zfs:/root # zpool create tank raidz disk0 disk1 disk2 disk3 disk4 disk5 disk6 disk7 spare disk8 disk9
cannot open 'disk0': no such GEOM provider
must be a full path or shorthand device name

not success,because disk0 maybe conflict with raid1 disk disk name (da0)
so use gpart modify change da1 label name



root@FreeBSD-zfs:/root # gpart  modify -i 1 -l disk10 da1 da1p1 modified




verify modify


root@FreeBSD-zfs:/root # gpart list da1 
Geom name: da1
modified: false
state: OK
fwheads: 255
fwsectors: 63
last: 1953525134
first: 34
entries: 128
scheme: GPT
Providers:
1. Name: da1p1
   Mediasize: 1000204851712 (931G)
   Sectorsize: 512
   Stripesize: 0
   Stripeoffset: 17408
   Mode: r1w1e1
   rawuuid: 23c46e3a-5b92-11e2-bd81-001e674f5978
   rawtype: 516e7cba-6ecf-11d6-8ff8-00022d09712b
   label: disk10
   length: 1000204851712
   offset: 17408
   type: freebsd-zfs
   index: 1
   end: 1953525134
   start: 34



recreate zfs 


root@FreeBSD-zfs:/root # zpool create tank raidz disk0 disk1 disk2 disk3 disk4 disk5 disk6 disk7 spare disk8 disk9 



root@FreeBSD-zfs:/root # zfs list
NAME   USED  AVAIL  REFER  MOUNTPOINT
tank   975M  6.20T   975M  /mnt
success,^_^。

I do another stupid work, execute

echo 'vfs.root.mountfrom="zfs:zroot"' >> /boot/loader.conf
and reboot
But the FreeBSD give up mount root partion,give me message 


GEOM: da11: geometry does not match label (64h,33s != 255h,63s).
GEOM: da11: media size does not match label.
Trying to mount root from zfs:zroot []...
Mounting from zfs:zroot failed with error 2.
Loader variables:
  vfs.root.mountfrom=zfs:zroot
Manual root filesystem specification:
  <fstype>:<device> [options]
      Mount <device> using filesystem <fstype>
      and with the specified (optional) option list.
    eg. ufs:/dev/da0s1a
        zfs:tank
        cd9660:/dev/acd0 ro
          (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /)
  ?               List valid disk boot devices
  .               Yield 1 second (for background tasks)
  <empty line>    Abort manual input
mountroot>
restart ,I want to use usb FreeBSD  memory stick system fix.
But my friend have erase the memory stick.
So, enter mimiboot?
>unload all module,and boot
but stop at mountroot second time.
mountroot>ufs:/dev/da0p2

FreeBSD accept,and mount all partion and zfs.



root@FreeBSD-zfs:/root # df -h
Filesystem    Size    Used   Avail Capacity  Mounted on
/dev/da0p2    9.7G    385M    8.5G     4%    /
devfs         1.0k    1.0k      0B   100%    /dev
/dev/da0p4     48G     32M     44G     0%    /var
/dev/da0p5     96G    1.2G     88G     1%    /usr
/dev/da0p6    9.7G     32M    8.9G     0%    /home
/dev/da0p7    732G     38M    673G     0%    /usr/local
tank          6.2T    975M    6.2T     0%    /mnt



dmesage show hard drivers:
da0: <LSI Logical Volume 3000> Fixed Direct Access SCSI-6 device 
da0: 952720MB (1951170560 512 byte sectors: 255H 63S/T 121454C)
da10 at mps0 bus 0 scbus2 target 29 lun 0
da10: <ATA ST91000640NS SN03> Fixed Direct Access SCSI-6 device 
da10: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
da9 at mps0 bus 0 scbus2 target 28 lun 0
da9: <ATA ST91000640NS SN03> Fixed Direct Access SCSI-6 device 
da9: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
da8 at mps0 bus 0 scbus2 target 27 lun 0
da8: <ATA ST91000640NS SN03> Fixed Direct Access SCSI-6 device 
da8: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
da1 at mps0 bus 0 scbus2 target 4 lun 0
da1: <ATA ST91000640NS SN03> Fixed Direct Access SCSI-6 device 
da1: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
da7 at mps0 bus 0 scbus2 target 26 lun 0
da7: <ATA ST91000640NS SN03> Fixed Direct Access SCSI-6 device 
da7: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
da3 at mps0 bus 0 scbus2 target 22 lun 0
da3: <ATA ST91000640NS SN03> Fixed Direct Access SCSI-6 device 
da3: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
da5 at mps0 bus 0 scbus2 target 24 lun 0
da5: <ATA ST91000640NS SN03> Fixed Direct Access SCSI-6 device 
da5: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
da6 at mps0 bus 0 scbus2 target 25 lun 0
da6: <ATA ST91000640NS SN03> Fixed Direct Access SCSI-6 device 
da6: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
da4 at mps0 bus 0 scbus2 target 23 lun 0
da4: <ATA ST91000640NS SN03> Fixed Direct Access SCSI-6 device 
da4: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)
da2 at mps0 bus 0 scbus2 target 5 lun 0
da2: <ATA ST91000640NS SN03> Fixed Direct Access SCSI-6 device 
da2: 953869MB (1953525168 512 byte sectors: 255H 63S/T 121601C)


todo ZFS porfermance