TOP
«
»

FreeNAS 0.7.2 (FreeBSD) で WD20EARS (Advanced Format) を使う (MBR用)

単一MBRパーティションで作成する場合は、fdiskでデフォルトスライスを
作成してbsdlabelで調整します。

# fdisk -BI /dev/ad4
# bsdlabel -w /dev/ad4s1
# fdisk -s /dev/ad4
/dev/ad4: 3876021 cyl 16 hd 63 sec
Part        Start        Size Type Flags
   1:          63  3907029105 0xa5 0x80
# bsdlabel /dev/ad4s1
# /dev/ad4s1:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a: 3907029089       16    unused        0     0
  c: 3907029105        0    unused        0     0         # "raw" part, don't edit
 

この段階で上記のような設定になります。63セクタがパーティション開始、
BSDパーティションが16セクタから(先頭から見ると63+16=79セクタ目)
になります。
4Kセクタに合わせるために開始セクタを+1(80セクタ/4K=512×8/8×10)して、
サイズを-1します。fstypeに4.2BSDを指定します。

※ fsize bsizeは指定しなくても大丈夫なようです。newfsで指定するので。

# bsdlabel -e /dev/ad4s1

で直接ディスク上を編集するか、一旦ファイルに落として編集後にそれを
書き込み(リストア)します。

# bsdlabel /dev/ad4s1 > label.txt
# EDIT label.txt
# bsdlabel -R /dev/ad4s1 label.txt

今回はファイルで行いました。書き込むファイルはこんな感じ。

# cat label.txt
# /dev/ad4s1:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a: 3907029088       17    4.2BSD        0     0
  c: 3907029105        0    unused        0     0         # "raw" part, don't edit
 

できたらそのパーティションに対して書き込みテストを実行してみます。

# dd if=/dev/zero of=/dev/ad4s1a bs=1m count=8k
8192+0 records in
8192+0 records out
8589934592 bytes transferred in 93.156833 secs (92209388 bytes/sec)
 

満足いく結果になったら4Kフラグメントでフォーマットします。

# newfs -S 4096 -b 32768 -f 4096 -O 2 -U -m 8 -o time /dev/ad4s1a

最後にラベルが書き込み出来ないと文句を言われます。
が、無視します。(理由はわからない)
同様に書き込みテストを行います。

# mkdir /mnt2
# mount /dev/ad4s1a /mnt2
# dd if=/dev/zero of=/mnt2/test.data bs=1m count=8k
8192+0 records in
8192+0 records out
8589934592 bytes transferred in 91.816939 secs (93555009 bytes/sec)
 

複数のパーティションを作成したい場合は、最初のoffset以外に * を指定して
自動計算させる事ができます。
以下の例は /に512MB, swapに4GB, /varに4GB, /tmpに1GB, /usrに20GB,
残りを/homeに割り当てようと意図した構成です。

# cat label.txt
# /dev/ad4s1:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a:     512M       17    4.2BSD        0     0
  b:       4G        *      swap        0     0
  c: 3907029105        0    unused        0     0         # "raw" part, don't edit
  d:       4G        *    4.2BSD        0     0
  e:       1G        *    4.2BSD        0     0
  f:      20G        *    4.2BSD        0     0
  g:        *        *    4.2BSD        0     0

# bsdlabel -R /dev/ad4s1 label.txt
# bsdlabel /dev/ad4s1
# /dev/ad4s1:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a:  1048576       17    4.2BSD        0     0     0
  b:  8388608  1048593      swap
  c: 3907029105        0    unused        0     0         # "raw" part, don't edit
  d:  8388608  9437201    4.2BSD        0     0     0
  e:  2097152 17825809    4.2BSD        0     0     0
  f: 41943040 19922961    4.2BSD        0     0     0
  g: 3845163104 61866001    4.2BSD        0     0     0
 

作成できたら、swap以外のパーティションにnewfsを実行します。

# newfs -S 4096 -b 32768 -f 4096 -O 2 -U -m 8 -o time /dev/ad4s1a
# newfs -S 4096 -b 32768 -f 4096 -O 2 -U -m 8 -o time /dev/ad4s1d
# newfs -S 4096 -b 32768 -f 4096 -O 2 -U -m 8 -o time /dev/ad4s1e
# newfs -S 4096 -b 32768 -f 4096 -O 2 -U -m 8 -o time /dev/ad4s1f
# newfs -S 4096 -b 32768 -f 4096 -O 2 -U -m 8 -o time /dev/ad4s1g

補足:
通常の/パーティションはSoftupdateを有効にしないので、
newfsで-Uを付けないか、すでに作成した場合は、

# tunefs -n disable /dev/ad4s1a

で無効にしたほうが良いかもしれません。

タグ: , ,

コメント / トラックバック3件

  1. Chris McQ より:

    I’m using WD15EARS drives in an Intel SS4200NAS using FreeNAS (0.7.1 Shere (revision 5065) . I’ve been curious if I needed to “advance format” these drives. My intent though is to use them with ZFS (RaidZ). With raidZ there really are no special format options. If using ZFS is there anything I need to do to optimize performance using the WD*EARS drives?

  2. [...] This post was mentioned on Twitter by 森 秀樹, 森 秀樹, 森 秀樹 and others. 森 秀樹 said: VMマシン上でFreeBSD OSのディスクアクセスが遅い問題って何も考えずに作ると4Kのアライメントとずれたファイルシステムが出来上がるせいじゃないだろうか。http://bit.ly/fn4UJZ [...]

  3. Tracen より:

    Big help, big help. And superlative news of corsue.

コメントをどうぞ