천불동 전체글 보기/검색

 알 립 니 다

 대 중 공 사

 가 입 인 사

 정자나무 그늘

 행사/번개/후기

 천불동 앨범

 순례/풍경/문화 갤러리

 가족/연인/친구 갤러리

 교계행사,공연 알림

 천불모(어머니방)

 푸른벌판(청소년)

 천불동 웹 법계 만들기


  천불동 웹 법계 만들기

※천불동의 웹프로그램 개발과 서버 운영에 대한 기술 노트입니다. 볼 사람도 없겠지만 천불동을 만들어나가는 과정을 적나라~하게 드러내는 것이 공동체의 의미에 맞다고 보아서 공개합니다.
혹 진짜 프로그래머가 보신다면 이건 어디까지나 아마추어 초보의 작업이니까.. 너무 비웃지 마시고 지도해주실 건 지도해주시기 바랍니다.

제목   (실패)[FreeBSD] Data Drive with 4096B sectors -- for WD advanced format hdd
이름 숨결 날짜 2011-01-03 [01:16] 조회 3756
 
http://forums.freebsd.org/showpost.php?p=76147&postcount=37

April 4th, 2010, 19:55 

turb013 
Junior Member  Join Date: Mar 2010
Location: Colorado, USA
Posts: 19
Thanks: 14
Thanked 6 Times in 3 Posts 

Data Drive with 4096B sectors
------------------------------------------------------------------------
This tutorial uses the freeBSD command "BSDlabel" to align and partition a drive. I
then used the freeBSD command "newfs" to format the drive.

Just to clarify what this is about precisely, I am referring to the new
hard drives that use 4096B (4K) sectors as opposed to more traditional
512B sectors. Currently, the Western Digital Green drives with "wears"
in their model number are examples of 4K sector drives. And, this "how to"
will show you how to align your partition to 4K boundaries and format the
drive to 4K sectors. This will give you the best performance.

I used the freeBSD command "BSDlabel" to align and partition my drive. I
then used the freeBSD command "newfs" to format the drive.

The first step is to determine the physical characteristics of your drive.
To do this type the following command into your console:
-----Code:-----
diskinfo -v ad4  <-- replace ad4 with your drive identifier
---------------

You will get something like this:
-----Code:-----
/dev/ad4
  512        # sector size
  15003191006      #media size in bytes (1.4T)
  2930277168      #media size in sectors
  2907021        #Cylinders according to firmware 
  16        #Heads according to firmware
  63        #Sectors according to firmware
  ad:WD-WMAVU1303392  #diskident
---------------

Notice that the drive reports that it uses 512B sectors when it actually uses
4096B sectors. This does not make this process any easier. Are you listening
Western Digital?

The first thing we want to take a look at is the reported media size in sectors.
The drive reports that for my drive (The Western Digital 1.5 gig WD-15EARS) it
has a total of 2930277168 512B sectors (your drive may have a different number
if it is for example a 2 terabyte drive) . I choose to use a block size of 32768
because it is evenly divisible by both 512 and 4096. So the next step I took was
to divide 2930277168 by 32768.

-----Code:-----
2930277168 / 32768 = 89424.96240234375
---------------

Obviously, 32768 does not divide evenly into 2930277168. So to get the largest
number of 512B sectors that would be evenly divisible by 32768 I simply took
89424 (the integer part of 89424.96240234375) and multiplied it by 32768.

-----Code:-----
89424 * 32768 = 2930245632 <-- We will use this number to calculate the
size of the drive in sectors. The number we come up with will be the size
parameter needed by "BSDlabel".
---------------

Those who are paying attention will notice that I am not using the entire drive:
-----Code:-----
2930277168 - 2930245632 = 31523  <-- Approximately 15.4 MB at the end of the
drive are not being used. For me the performance gains are worth the loss of
a few megabytes on a 1.5 terabyte drive.
---------------

Before we can get a final size we need to determine the offset. When "BSDlabel"
creates a slice/partition it does not start it at the first sector it starts it
at sector 63.

-----Code:-----
63 * 512 = 32256
---------------

So in order to align the start of the slice/partition to a 4K boundary you need
an offset of 1 (512B sector).

-----Code:-----
32256 + 512 = 32768 <-- 4K boundary since 32768 can be evenly divided by 4096
---------------

So now that we have the major parameters for "BSDlabel" we need to make a
configuration file. I called mine datadrive.cfg. It is a simple text file. But,
it requires the parameters to be presented in the following format (Lines starting
with "#" are comments):

-----Code:-----
# datadrive.cfg

8 partitions:
#        size      offset    fstype    [fsize    bsize    bps/cpg]
a:  2930212864          1    4.2BSD      4096    32768
---------------

In this example I created a single data partition covering the entire drive. And, it is
not a boot partition. The first parameter is the slice/partition name "a:". The second
parameter is the size of the partition in 512B sectors. The number I used is 2930245632
minus 32768. This is because I had to subtract the start sector of the slice/partition
(sector 63) plus the offset (one 512B sector). We lost another 512B of space of the
total drive space here...Oh well

-----Code:-----
63 * 512 = 32256
32256 + 512 = 32768
2930245632 - 32768 = 2930212864 <-- sector size of my 1.5TB drive)
---------------

The next parameter is the file system type (fstype) here I used 4.2BSD. The last three
parameters are not required. But, I used 4096 for the fragment size (fsize) and 32768
for the block size (bsize). Once you have created this file you are ready to use "BSDlabel"
to create your slice/partition and align the drive. Here is the command line:

-----Code:-----
bsdlabel -R  /dev/ad4 datadrive.cfg <-- Replace ad4 with your drive identifier
---------------

Note: You will not be able to create this slice if the drive you are creating it on is
mounted.

See FreeBSD man pages BSDlabel(8) for more information on "BSDlabel".

The next step is to format the drive with "newfs". Here is the command line that I used:

-----Code:-----
newfs -S 4096 -b 32768 -f 4096 -O 2 -U -m 8 -o space -L datadrive /dev/ad4
---------------

Note: The newfs example above uses UFS2 as the file system ("-O 2"). If you want to use UFS1 then use "-O 1".

Details:
-----Code:-----
-S 4096 = sector size
-b 32768 = block size
-f 4096 = fragment size
-O 2 = UFS2 file system
-U = Enable soft updates on the new file system
-m 8 = The percentage of space reserved from normal users; the minimum
      free space threshold.
-o space = Optimize for space rather than time
-L datadrive = Label the drive as "datadrive"
/dev/ad4 = This is your drive identifer.
---------------

See FreeBSD man pages newfs(8) for more information on "newfs".

===============


# WD advanced format hdd 를 FreeBSD에 사용하기
# WD20EARS
#
#
# diskinfo -v ad3
#------------------------
#ad3
#    512            # sectorsize
#    2000398934016    # mediasize in bytes (1.8T)
#    3907029168      # mediasize in sectors
#    3876021        # Cylinders according to firmware.
#    16              # Heads according to firmware.
#    63              # Sectors according to firmware.
#    ad:WD-WCAZA3994610    # Disk ident.
#------------------------
#
# block size 를 512와 4096의 공배수인 32768로 한다.

# 3907029168 / 32768 = 119233.06787109375  전체 섹터 수를 block size로 나눠서 정수만 취한다.
# 119233 * 32768 = 3907026944 전체 섹터 수를 이렇게 정한다.

# BSDlavel 명령은 원래 sector 63에서 부터 파티션을 시작한다.
# 거기다 다시 512b 한 섹터를 더 내놓고 4K 섹터의 파티션을 시작한다.
# 64*512 = 32768

# 3907026944 - 32768 = 3906994176  이것이 2T 하드의 총 섹터용량이 된다.


# 2tdrive.cfg

8 partitions:
#    size        offset        fstype        [fsize    bsize    bps/cpg]
a:    3906994176    1        4.2BSD        4096        32768

# bsdlabel -R  /dev/ad3 2tdrive.cfg  파티션 완성됨
# newfs -S 4096 -b 32768 -f 4096 -O 2 -U -m 8 -o space -L datadrive /dev/ad3  포맷


# 부팅 디스크는 또 어떻게 만들 것인지?


##########
########## 그런데 해보니까 안되더라. 결국 실패!!!!!!!!!!
##########



M$ Windog XP 에서 WD Advanced format hdd
IEToy "새탭에서 열기" 문제

db 제    목 이  름 조회 등록일
776  Javascript URL Base64 인코딩/디코딩 숨결 2147 2012-08-17
775  FreeBSD option usb3.0 설치 test 숨결 2729 2012-02-14
774  Intel processor 제원비교표 ; vt-x 중심 숨결 2307 2012-01-01
773  USB 3.0 host-to-host 연결 -간단쓰! 숨결 2781 2011-12-30
772  frame 메뉴의 target 이 먹지 않는 이유 숨결 2245 2011-12-05
771  crontab 의 시간상 중복 문제 숨결 2598 2011-12-05
770  FreeBSD WD advanced format hdd 달기! 숨결 2576 2011-03-27
769  ie8의 한글 이름 파일 다운로드 문제 숨결 3015 2011-03-01
768  파일 업로드 이름 바꾸기 개선 숨결 4267 2011-02-20
767  FreeBSD의 OS 백업과 되살리기 숨결 3284 2011-02-03
766  M$ Windog XP 에서 WD Advanced format hdd 숨결 5256 2011-01-14
765  (실패)[FreeBSD] Data Drive with 4096B sectors -- for WD advanced f… 숨결 3756 2011-01-03
764  IEToy "새탭에서 열기" 문제 숨결 3592 2010-12-12
763  FreeBSD: gd library 설치 숨결 3286 2010-06-08
762  무조건 알아야 할 PHP 속도 테스트 20 가지 숨결 4049 2010-05-06

 
게시물 수: 547 /  검색:
[1][2][3][4][5][6][7][8][9][10]-[뒷10쪽] [37]  
Powerd by  

        FreeBSD 7.2

              Apache 2.2.13
     
            PHP 5.2.10

              mySQL 5.1.36

천불동소개 |사이트맵 |운영진에게 |처음으로
 Copyleft 2001,2003 천불동(buddhasite.net)  All rights are opened.