免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
1234下一页
最近访问板块 发新帖
查看: 17293 | 回复: 32
打印 上一主题 下一主题

[FreeBSD] 【硬盘分区】FreeBSD 移动硬盘分区 [复制链接]

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-08-28 20:48 |只看该作者 |倒序浏览
本帖最后由 ulovko 于 2012-09-08 10:21 编辑

目前需求: 分割移动硬盘,并能够拷贝超过5GB大小的单个文件; 该硬盘长期作用于FreeBSD && MS WINDOWS ..
分区方案: 2分区 (FAT32 + FreeBSD)
分区大小: 1/2 Size /Partition


  1. ko# dd if=/dev/zero of=/dev/da0 bs=1k count=1       # 跟移动硬盘打个招呼说:“表妹,跟我走吧!” $_$
  2. ko# fdisk -BI da0                                   # 其实是聊聊天,明天会不会下雨呵? O_o
复制代码
  1. ko# fdisk -u /dev/da0                               # 好了,聊天过后进入真题 ^_^
  2. ******* Working on device /dev/da0 *******
  3. parameters extracted from in-core disklabel are:
  4. cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

  5. Figures below won't work with BIOS for partitions not in cyl 1
  6. parameters to be used for BIOS calculations are:
  7. cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

  8. Do you want to change our idea of what BIOS thinks ? [n] n
  9. Media sector size is 512
  10. Warning: BIOS sector numbering starts with sector 1
  11. Information from DOS bootblock is:
  12. The data for partition 1 is:
  13. sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
  14.     start 63, size 976768002 (476937 Meg), flag 80 (active)
  15.         beg: cyl 0/ head 1/ sector 1;
  16.         end: cyl 384/ head 254/ sector 63
  17. Do you want to change it? [n] y
  18. Supply a decimal value for "sysid (165=FreeBSD)" [165]
  19. Supply a decimal value for "start" [63]
  20. Supply a decimal value for "size" [976768002] 488384064
  21. ================================================================
  22. > echo '976768002/2' |bc
  23. 488384001

  24. > echo '488384001+63' |bc
  25. 488384064
  26. ================================================================

  27. Explicitly specify beg/end address ? [n]
  28. sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
  29.     start 63, size 488384064 (238468 Meg), flag 80 (active)
  30.         beg: cyl 0/ head 1/ sector 1;
  31.         end: cyl 704/ head 128/ sector 63
  32. Are we happy with this entry? [n] y
  33. The data for partition 2 is:
  34. <UNUSED>
  35. Do you want to change it? [n] y
  36. Supply a decimal value for "sysid (165=FreeBSD)" [0] 12
  37. Supply a decimal value for "start" [0] 488384127
  38. Supply a decimal value for "size" [0] 488383876
  39. ================================================================
  40. > echo '488384064+62' |bc
  41. 488384126

  42. > echo '976768002-488384126' |bc
  43. 488383876
  44. ================================================================
  45. fdisk: WARNING: partition does not end on a cylinder boundary
  46. fdisk: WARNING: this may confuse the BIOS or some operating systems
  47. Correct this automatically? [n] y
  48. fdisk: WARNING: adjusting size of partition to 488367873
  49. Explicitly specify beg/end address ? [n]
  50. sysid 12 (0x0c),(DOS or Windows 95 with 32 bit FAT (LBA))
  51.     start 488384127, size 488367873 (238460 Meg), flag 0
  52.         beg: cyl 704/ head 129/ sector 1;
  53.         end: cyl 383/ head 254/ sector 63
  54. Are we happy with this entry? [n] y
  55. The data for partition 3 is:
  56. <UNUSED>
  57. Do you want to change it? [n]
  58. The data for partition 4 is:
  59. <UNUSED>
  60. Do you want to change it? [n]
  61. Partition 1 is marked active
  62. Do you want to change the active partition? [n]

  63. We haven't changed the partition table yet.  This is your last chance.
  64. parameters extracted from in-core disklabel are:
  65. cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

  66. Figures below won't work with BIOS for partitions not in cyl 1
  67. parameters to be used for BIOS calculations are:
  68. cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

  69. Information from DOS bootblock is:
  70. 1: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
  71.     start 63, size 488384064 (238468 Meg), flag 80 (active)
  72.         beg: cyl 0/ head 1/ sector 1;
  73.         end: cyl 704/ head 128/ sector 63
  74. 2: sysid 12 (0x0c),(DOS or Windows 95 with 32 bit FAT (LBA))
  75.     start 488384127, size 488367873 (238460 Meg), flag 0
  76.         beg: cyl 704/ head 129/ sector 1;
  77.         end: cyl 383/ head 254/ sector 63
  78. 3: <UNUSED>
  79. 4: <UNUSED>
  80. Should we write new partition table? [n] y
复制代码
对FreeBSD分区进行格式化:

  1. ko# newfs -U /dev/da0s1
  2. /dev/da0s1: 238468.8MB (488384064 sectors) block size 32768, fragment size 4096
  3.         using 323 cylinder groups of 740.00MB, 23680 blks, 47360 inodes.
  4.         with soft updates
  5. super-block backups (for fsck -b #) at:
  6. 192, 1515712, 3031232, 4546752, 6062272, 7577792, 9093312, 10608832, 12124352,
  7. 13639872, 15155392, 16670912, 18186432, 19701952, 21217472, 22732992,
  8. 24248512, 25764032, 27279552, 28795072, 30310592, 31826112, 33341632,
  9. 34857152, 36372672, 37888192, 39403712, 40919232, 42434752, 43950272,
  10. 45465792, 46981312, 48496832, 50012352, 51527872, 53043392, 54558912,
  11. 56074432, 57589952, 59105472, 60620992, 62136512, 63652032, 65167552,
  12. 66683072, 68198592, 69714112, 71229632, 72745152, 74260672, 75776192,
  13. 77291712, 78807232, 80322752, 81838272, 83353792, 84869312, 86384832,
  14. 87900352, 89415872, 90931392, 92446912, 93962432, 95477952, 96993472,
  15. 98508992, 100024512, 101540032, 103055552, 104571072, 106086592, 107602112,
  16. 109117632, 110633152, 112148672, 113664192, 115179712, 116695232, 118210752,
  17. 119726272, 121241792, 122757312, 124272832, 125788352, 127303872, 128819392,
  18. 130334912, 131850432, 133365952, 134881472, 136396992, 137912512, 139428032,
  19. 140943552, 142459072, 143974592, 145490112, 147005632, 148521152, 150036672,
  20. 151552192, 153067712, 154583232, 156098752, 157614272, 159129792, 160645312,
  21. 162160832, 163676352, 165191872, 166707392, 168222912, 169738432, 171253952,
  22. 172769472, 174284992, 175800512, 177316032, 178831552, 180347072, 181862592,
  23. 183378112, 184893632, 186409152, 187924672, 189440192, 190955712, 192471232,
  24. 193986752, 195502272, 197017792, 198533312, 200048832, 201564352, 203079872,
  25. 204595392, 206110912, 207626432, 209141952, 210657472, 212172992, 213688512,
  26. 215204032, 216719552, 218235072, 219750592, 221266112, 222781632, 224297152,
  27. 225812672, 227328192, 228843712, 230359232, 231874752, 233390272, 234905792,
  28. 236421312, 237936832, 239452352, 240967872, 242483392, 243998912, 245514432,
  29. 247029952, 248545472, 250060992, 251576512, 253092032, 254607552, 256123072,
  30. 257638592, 259154112, 260669632, 262185152, 263700672, 265216192, 266731712,
  31. 268247232, 269762752, 271278272, 272793792, 274309312, 275824832, 277340352,
  32. 278855872, 280371392, 281886912, 283402432, 284917952, 286433472, 287948992,
  33. 289464512, 290980032, 292495552, 294011072, 295526592, 297042112, 298557632,
  34. 300073152, 301588672, 303104192, 304619712, 306135232, 307650752, 309166272,
  35. 310681792, 312197312, 313712832, 315228352, 316743872, 318259392, 319774912,
  36. 321290432, 322805952, 324321472, 325836992, 327352512, 328868032, 330383552,
  37. 331899072, 333414592, 334930112, 336445632, 337961152, 339476672, 340992192,
  38. 342507712, 344023232, 345538752, 347054272, 348569792, 350085312, 351600832,
  39. 353116352, 354631872, 356147392, 357662912, 359178432, 360693952, 362209472,
  40. 363724992, 365240512, 366756032, 368271552, 369787072, 371302592, 372818112,
  41. 374333632, 375849152, 377364672, 378880192, 380395712, 381911232, 383426752,
  42. 384942272, 386457792, 387973312, 389488832, 391004352, 392519872, 394035392,
  43. 395550912, 397066432, 398581952, 400097472, 401612992, 403128512, 404644032,
  44. 406159552, 407675072, 409190592, 410706112, 412221632, 413737152, 415252672,
  45. 416768192, 418283712, 419799232, 421314752, 422830272, 424345792, 425861312,
  46. 427376832, 428892352, 430407872, 431923392, 433438912, 434954432, 436469952,
  47. 437985472, 439500992, 441016512, 442532032, 444047552, 445563072, 447078592,
  48. 448594112, 450109632, 451625152, 453140672, 454656192, 456171712, 457687232,
  49. 459202752, 460718272, 462233792, 463749312, 465264832, 466780352, 468295872,
  50. 469811392, 471326912, 472842432, 474357952, 475873472, 477388992, 478904512,
  51. 480420032, 481935552, 483451072, 484966592, 486482112, 487997632
复制代码
对FAT32 分区进行格式化:

  1. ko# newfs_msdos /dev/da0s2
  2. /dev/da0s2: 488248576 sectors in 7628884 FAT32 clusters (32768 bytes/cluster)
  3. BytesPerSec=512 SecPerClust=64 ResSectors=32 FATs=2 Media=0xf0 SecPerTrack=63 Heads=255 HiddenSecs=0 HugeSectors=488367873 FATsecs=59601 RootCluster=2 FSInfo=1 Backup=2
复制代码
显示分区情况:

  1. ko# fdisk /dev/da0
  2. ******* Working on device /dev/da0 *******
  3. parameters extracted from in-core disklabel are:
  4. cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

  5. Figures below won't work with BIOS for partitions not in cyl 1
  6. parameters to be used for BIOS calculations are:
  7. cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

  8. Media sector size is 512
  9. Warning: BIOS sector numbering starts with sector 1
  10. Information from DOS bootblock is:
  11. The data for partition 1 is:
  12. sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
  13.     start 63, size 488384064 (238468 Meg), flag 80 (active)
  14.         beg: cyl 0/ head 1/ sector 1;
  15.         end: cyl 704/ head 128/ sector 63
  16. The data for partition 2 is:
  17. sysid 12 (0x0c),(DOS or Windows 95 with 32 bit FAT (LBA))
  18.     start 488384127, size 488367873 (238460 Meg), flag 0
  19.         beg: cyl 704/ head 129/ sector 1;
  20.         end: cyl 383/ head 254/ sector 63
  21. The data for partition 3 is:
  22. <UNUSED>
  23. The data for partition 4 is:
  24. <UNUSED>
复制代码
挂载分区:

  1. ko# mount /dev/da0s1 /media/
  2. ko# mount_msdosfs /dev/da0s2 /mnt/
  3. mount_msdosfs: /dev/da0s2: Disk too big, try '-o large' mount option: Invalid argument

  4. ko# mount_msdosfs -o large /dev/da0s2 /mnt/
复制代码
检查一下:
  1. ko# df
  2. Filesystem     Size    Used   Avail Capacity  Mounted on
  3. /dev/ada0p2    9.9G    649M    8.4G     7%    /
  4. devfs          1.0k    1.0k      0B   100%    /dev
  5. /dev/ada0p4    118G     27G     81G    25%    /var
  6. /dev/ada0p5      2G     23M    1.8G     1%    /tmp
  7. /dev/ada0p6    118G     46G     62G    43%    /usr
  8. /dev/ada0p7    103G     64G     31G    67%    /usr/home
  9. /dev/da0s1     229G    8.0k    210G     0%    /media
  10. /dev/da0s2     232G     96k    232G     0%    /mnt

  11. ko# gpart show da0
  12. =>       63  976773105  da0  MBR  (465G)
  13.          63  488384064    1  freebsd  [active]  (232G)
  14.   488384127  488367873    2  !12  (232G)
  15.   976752000      21168       - free -  (10M)
复制代码
搞定晒 ^_^


一会把片弄到移动硬盘里面,听说最近cyber police 盯得很紧、东北有人进去了 ^_^
  1. > ls ~/Movies/
  2. MM
  3. France_L_As_Des_As1982.mkv
  4. France_La_Grande_Vadrouille1966.rmvb
  5. France_Les_Fugitifs1986.avi
  6. France_Les_Morfalous1984.rm
  7. France_The-Intouchables2011.rmvb
  8. GE_Der-Untergang2004.rmvb
  9. GE_Stalingrad1993CD1.rmvb
  10. GE_Stalingrad1993CD2.rmvb
  11. GE_Stalingrad1993CD3.rmvb
  12. HK_A-Better-Tomorrow1986.mkv
  13. HK_A_Better_Tomorrow1986-01.mkv
  14. HK_Ashes-of-Time-Redux2008.rmvb
  15. HK_Beyond1991.mkv
  16. HK_GEM-Concert2011.rmvb
  17. HK_Once-A-Thief1991.mkv
  18. HK_TVB-BEYOND2008.rmvb
  19. HK_TVB-Leslie2008.rmvb
  20. HK_TianLongBabu97.flv
  21. Norway_Nokas2010.rmvb
  22. TMP_Akira-Yamaoka-Promise.flv
  23. TMP_Best-native-games4Linux2012.flv
  24. TMP_Damn-Yankees_Where-u-Going-Now.flv
  25. TMP_Lost-Paradise_Juliette-Valduriez.flv
  26. TMP_OpenBSD-Interview.flv
  27. TMP_ZhouHongYi-Interview.flv
  28. UK_Attack-on-Leningrad2009.rmvb
  29. UK_Escape-to-Athena1979.mkv
  30. UK_From-Up-on-Poppy-Hill2011.mkv
  31. UK_Lock_Stock-and-Two-Smoking-Barrels1998.rmvb
  32. UK_Snatch2000.rmvb
  33. UK_The-Children-of-Heaven1997.mkv
  34. UK_The-Pianist.rmvb
  35. USA_Bad-BoysII2003.rmvb
  36. USA_Brave-Heart1995.rmvb
  37. USA_Flyboys2006.rmvb
  38. USA_Kellys_Heroes1970.rmvb
  39. USA_Life-is-Beautiful1997.rmvb
  40. USA_Memorial-Day2011.rmvb
  41. USA_Patton1970-CD1.rmvb
  42. USA_Patton1970-CD2.rmvb
  43. USA_Platoon1986.rmvb
  44. USA_Pulp-Fiction1994.rmvb
  45. USA_Sahara1995-CN.rmvb
  46. USA_Sahara1995-EN.avi
  47. USA_Scent-of-a-Woman1992.rmvb
  48. USA_SchindlersList1993.mkv
  49. USA_The-Longest-Day1962.mkv
  50. USA_The-Pursuit-of-Happyness2006.rmvb
  51. USA_The-Shawshank-Redemption1994.rmvb
  52. USA_Where-Eagles-Dare1968.rmvb
  53. >
复制代码
GPT: http://bbs.chinaunix.net/forum.p ... mp;fromuid=25256412

论坛徽章:
0
2 [报告]
发表于 2012-08-29 09:08 |只看该作者
能不能分个NTFS分区? 不知道怎么分呢?

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
3 [报告]
发表于 2012-08-29 09:30 |只看该作者
回复 2# obsd178


    NTFS sysid是多少?就写多少好了 没什么太大区别 ^_^

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
4 [报告]
发表于 2012-08-29 09:37 |只看该作者
HowTo: Mounting NTFS partition in write mode on FreeBSD

My brother's old laptop died and I got to keep its hard-drive. Being a Windows machine, it had a bunch of NTFS partitions.
So this post explains how to identify a NTFS partition, mount it as read-only and finally learn how to mount it in write mode.
I should mention that FreeBSD 7.4 was used but the same steps should apply to latter versions of the OS.

Physically attached the hard-drive (in my case I plugged an USB HDD) and have a look at /var/log/messages to identify the harddrive.
  1. # tail -n 20 /var/log/messages
  2. Jan 26 21:40:03 flumen kernel: da0: Fixed Direct Access SCSI-4 device
  3. Jan 26 21:40:03 flumen kernel: da0: 40.000MB/s transfers
  4. Jan 26 21:40:03 flumen kernel: da0: 114473MB (234441648 512 byte sectors: 255H 63S/T 14593C)
  5. Similar information can be collected from dmesg.

  6. # dmesg
  7. umass0: on uhub4
  8. da0 at umass-sim0 bus 0 target 0 lun 0
  9. da0: Fixed Direct Access SCSI-4 device
  10. da0: 40.000MB/s transfers
  11. da0: 114473MB (234441648 512 byte sectors: 255H 63S/T 14593C)
  12. Let's find out which is the NTFS partition:
复制代码
  1. # fdisk /dev/da0
  2. ******* Working on device /dev/da0 *******
  3. parameters extracted from in-core disklabel are:
  4. cylinders=14593 heads=255 sectors/track=63 (16065 blks/cyl)

  5. Figures below won't work with BIOS for partitions not in cyl 1
  6. parameters to be used for BIOS calculations are:
  7. cylinders=14593 heads=255 sectors/track=63 (16065 blks/cyl)

  8. Media sector size is 512
  9. Warning: BIOS sector numbering starts with sector 1
  10. Information from DOS bootblock is:

  11. The data for partition 1 is:
  12. sysid 18 (0x12),(Compaq diagnostics)
  13. start 63, size 16611147 (8110 Meg), flag 0
  14. beg: cyl 0/ head 1/ sector 1;
  15. end: cyl 1023/ head 254/ sector 63
  16. The data for partition 2 is:
  17. sysid 7 (0x07),(OS/2 HPFS, NTFS, QNX-2 (16 bit) or Advanced UNIX)
  18. start 16611210, size 117194175 (57223 Meg), flag 80 (active)
  19. beg: cyl 1023/ head 0/ sector 1;
  20. end: cyl 1023/ head 254/ sector 63
  21. The data for partition 3 is:
  22. sysid 15 (0x0f),(Extended DOS (LBA))
  23. start 133805385, size 100631160 (49136 Meg), flag 0
  24. beg: cyl 1023/ head 0/ sector 1;
  25. end: cyl 1023/ head 254/ sector 63
  26. The data for partition 4 is:
复制代码
  1. Issuing the following command will mount a NTFS partition in read-only mode:
  2. # mount -t ntfs /dev/da0s2 /mnt/

  3. To be able to write into a NTFS partition it is required to install the sysutils/fuse-ntfs port:
  4. # cd /usr/ports/sysutils/fusefs-ntfs/ && make install clean

  5. If you use, as described in the man page, mount -t ntfs-3g an error will occurr:
  6. # mount -t ntfs-3g /dev/da0s2 /mnt/
  7. mount: /dev/da0s2 : Operation not supported by device

  8. To mount the NTFS partition in write mode issue:
  9. # ntfs-3g /dev/da0s2 /mnt/
复制代码
  1. Let's make sure that the partition is mounted:
  2. # mount
  3. /dev/ad4s1a on / (ufs, local)
  4. devfs on /dev (devfs, local)
  5. /dev/ad4s1e on /tmp (ufs, local, soft-updates)
  6. /dev/ad4s1f on /usr (ufs, local, soft-updates)
  7. /dev/ad4s1d on /var (ufs, local, soft-updates)
  8. /dev/ad5s1d on /mnt/1 (ufs, local, soft-updates)
  9. /dev/fuse0 on /mnt/2 (fusefs, local, synchronous)
复制代码

  1. > man ntfs-3g           #contains some Linuxisms and as such read the man page with a grain of salt
复制代码
FROM: http://linux-bsd-sharing.blogspo ... ition-in-write.html

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
5 [报告]
发表于 2012-08-29 10:18 |只看该作者
本帖最后由 ulovko 于 2012-08-31 19:18 编辑

将第二个分区改为NTFS:
  1. ko# fdisk -u /dev/da0
  2. ******* Working on device /dev/da0 *******
  3. parameters extracted from in-core disklabel are:
  4. cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

  5. Figures below won't work with BIOS for partitions not in cyl 1
  6. parameters to be used for BIOS calculations are:
  7. cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

  8. Do you want to change our idea of what BIOS thinks ? [n]
  9. Media sector size is 512
  10. Warning: BIOS sector numbering starts with sector 1
  11. Information from DOS bootblock is:
  12. The data for partition 1 is:
  13. sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
  14.     start 63, size 488384064 (238468 Meg), flag 80 (active)
  15.         beg: cyl 0/ head 1/ sector 1;
  16.         end: cyl 704/ head 128/ sector 63
  17. Do you want to change it? [n]
  18. The data for partition 2 is:
  19. sysid 12 (0x0c),(DOS or Windows 95 with 32 bit FAT (LBA))
  20.     start 488384127, size 488367873 (238460 Meg), flag 0
  21.         beg: cyl 704/ head 129/ sector 1;
  22.         end: cyl 383/ head 254/ sector 63
  23. Do you want to change it? [n] y
  24. Supply a decimal value for "sysid (165=FreeBSD)" [12] 7
  25. Supply a decimal value for "start" [488384127]
  26. Supply a decimal value for "size" [488367873]
  27. Explicitly specify beg/end address ? [n]
  28. sysid 7 (0x07),(NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX)
  29.     start 488384127, size 488367873 (238460 Meg), flag 0
  30.         beg: cyl 704/ head 129/ sector 1;
  31.         end: cyl 383/ head 254/ sector 63
  32. Are we happy with this entry? [n] y
  33. The data for partition 3 is:
  34. <UNUSED>
  35. Do you want to change it? [n]
  36. The data for partition 4 is:
  37. <UNUSED>
  38. Do you want to change it? [n]
  39. Partition 1 is marked active
  40. Do you want to change the active partition? [n] n

  41. We haven't changed the partition table yet.  This is your last chance.
  42. parameters extracted from in-core disklabel are:
  43. cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

  44. Figures below won't work with BIOS for partitions not in cyl 1
  45. parameters to be used for BIOS calculations are:
  46. cylinders=60801 heads=255 sectors/track=63 (16065 blks/cyl)

  47. Information from DOS bootblock is:
  48. 1: sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
  49.     start 63, size 488384064 (238468 Meg), flag 80 (active)
  50.         beg: cyl 0/ head 1/ sector 1;
  51.         end: cyl 704/ head 128/ sector 63
  52. 2: sysid 7 (0x07),(NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX)
  53.     start 488384127, size 488367873 (238460 Meg), flag 0
  54.         beg: cyl 704/ head 129/ sector 1;
  55.         end: cyl 383/ head 254/ sector 63
  56. 3: <UNUSED>
  57. 4: <UNUSED>
  58. Should we write new partition table? [n] y
复制代码
格式化 NTFS 分区:
  1. ko# mkntfs -Ffv /dev/da0s2
  2. Cluster size has been automatically set to 4096 bytes.
  3. Creating NTFS volume structures.
  4. Creating root directory (mft record 5)
  5. Creating $MFT (mft record 0)
  6. Creating $MFTMirr (mft record 1)
  7. Creating $LogFile (mft record 2)
  8. Creating $AttrDef (mft record 4)
  9. Creating $Bitmap (mft record 6)
  10. Creating $Boot (mft record 7)
  11. Creating backup boot sector.
  12. Failed to write to device /dev/da0s2.
  13. Couldn't write backup boot sector: Invalid argument
  14. Creating $Volume (mft record 3)
  15. Setting the volume dirty so check disk runs on next reboot into Windows.
  16. Creating $BadClus (mft record 8)
  17. Creating $Secure (mft record 9)
  18. Creating $UpCase (mft record 0xa)
  19. Creating $Extend (mft record 11)
  20. Creating system file (mft record 0xc)
  21. Creating system file (mft record 0xd)
  22. Creating system file (mft record 0xe)
  23. Creating system file (mft record 0xf)
  24. Creating $Quota (mft record 24)
  25. Creating $ObjId (mft record 25)
  26. Creating $Reparse (mft record 26)
  27. Syncing root directory index record.
  28. Syncing $Bitmap.
  29. Syncing $MFT.
  30. Updating $MFTMirr.
  31. Syncing device.
  32. mkntfs completed successfully. Have a nice day.
复制代码
  1. ko# gpart show da0
  2. =>       63  976773105  da0  MBR  (465G)
  3.          63  488384064    1  freebsd  [active]  (232G)
  4.   488384127  488367873    2  ntfs  (232G)
  5.   976752000      21168       - free -  (10M)
复制代码
Tips

  1. As I found out, there’s two packages for working with NTFS — ntfs-3g, and ntfsprogs.
  2. And of course they are conflicting. let me explain.
  3. ntfsprogs contains old ntfsprogs, while ntfs-3g have pretty current ntfsprogs set
  4. (in FreeBSD world, 1 year old is not old at all).

  5. And culmination of whole ports system is that ntfsprogs contains patched and working mkntfs,
  6. while ntfs-3g maintainers don’t bother.

  7. That was a bit of my frustration and helplessness >_<

  8. Here’s guide how to format NTFS disk:

  9. # cd /usr/ports/sysutils/ntfsprogs && make

  10. # cd /usr/ports/sysutils/ntfsprogs/work/ntfsprogs-2.0.0/ntfsprogs

  11. ./mkntfs [NEEDED FLAGS FROM MAN] /dev/xx


  12. That’s it!  Enjoy.
复制代码

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
6 [报告]
发表于 2012-08-29 10:20 |只看该作者
  1. > less /usr/local/share/doc/ntfs-3g/README.FreeBSD
  2. ==============================================================================
  3. NTFS-3G README for the FreeBSD port
  4. ==============================================================================

  5. 1. Introduction
  6. 2. Port specific notes
  7. 3. Mounting at startup with /etc/fstab
  8. 4. Ublio configuration
  9. 5. Known issues
  10. 6. Reporting bugs

  11. ==============================================================================
  12. 1. Introduction
  13. ==============================================================================

  14. The NTFS-3G project provides a read/write filesystem driver for NTFS. It uses
  15. the FUSE library (a OS independent library to create filesystem drivers), more
  16. precisely FUSE's library with fuse4bsd's kernel module (port of the kernel
  17. dependent part of FUSE). For more information see:

  18. NTFS-3G site:   http://ntfs-3g.org/
  19. FUSE site:      http://fuse.sourceforge.net/
  20. fuse4bsd site:  http://fuse4bsd.creo.hu/

  21. ==============================================================================
  22. 2. Port specific notes
  23. ==============================================================================

  24. The port has a patch to align read/write operations to the media block size
  25. (required on FreeBSD).

  26. The port has 2 options: LOCK (to prevent access to the device by external
  27. programs than NTFS-3G once mounted, default on Linux), and UBLIO (use a user
  28. space cache library, see devel/libublio, not required on Linux).

  29. The reason for using UBLIO is that FreeBSD removed support for block devices,
  30. being them now character devices. The former ones had a cache, and NTFS-3G was
  31. optimized for it (Linux still uses them). The same happens on Mac OS X (based
  32. on FreeBSD 5). So using UBLIO both improves performance (~10 times faster),
  33. and reduces disk load.

  34. ==============================================================================
  35. 3. Mounting at startup with /etc/fstab
  36. ==============================================================================

  37. To mount at startup you need to have the following line in /etc/rc.conf:

  38. fusefs_enable="YES"

  39. Then create the following symlink:

  40. $ ln -s `which ntfs-3g` /usr/sbin/mount_ntfs-3g

  41. And add the appropiate line to /etc/fstab: the filesystem should be "ntfs-3g"
  42. instead of "ntfs", and the additional "late" parameter is required. Example:

  43. /dev/ad4s1              /wxp            ntfs-3g rw,late         0       0

  44. Note that in FreeBSD 7.x, mount(8) has a fixed (hard coded) list of external
  45. mount_XXX programs that can be called, so to make this work you have to do one
  46. of the following:

  47. 1. Rename /sbin/mount_ntfs, symlink ntfs-3g as the former, and use just "ntfs"
  48.    as the type in /etc/fstab.
  49.    $ mv /sbin/mount_ntfs /sbin/mount_ntfs-kern
  50.    $ ln -s /usr/sbin/mount_ntfs-3g /usr/sbin/mount_ntfs
  51. 2. Apply a patch to src/sbin/mount/mount.c to add "ntfs-3g" as a valid type.
  52. 3. Apply a patch to src/sbin/mount/mount.c to make it work like in 6.x (better
  53.    than the previous one as will allow any external type). It can be found at:
  54.    http://people.freebsd.org/~alepulver/current-7.0-mount.diff

  55. ==============================================================================
  56. 4. Ublio configuration
  57. ==============================================================================

  58. The UBLIO layer is configured through environment variables, which are read
  59. when mounting the filesystem. The following are available:

  60. NTFS_USE_UBLIO  - Enable the UBLIO cache.
  61. UBLIO_BLOCKSIZE - Actual reads/writes will be multiples of this quantity.
  62. UBLIO_ITEMS     - Number of cache entries, each of UBLIO_BLOCKSIZE length.
  63. UBLIO_GRACE     - Number of times a cache entry will refuse being recycled.
  64. UBLIO_SYNC_IO   - If enabled, all writes will be immediatly executed.

  65. To give an idea about tuning, here are the default values with some notes
  66. (they are only based on some simple benchmarks, and may be wrong):

  67. NTFS_USE_UBLIO  - 1. Disabling it drastically decreases performance.
  68. UBLIO_BLOCKSIZE - 262144 (256KB). Larger improves reading/writing speed of
  69.                   large files, and smaller makes filesystem operations
  70.                   (creation, deletion, moving, find(1)) perform faster.
  71.                   Try 2/4MB and 512/256KB for the different approaches. Note
  72.                   that after that points performance descreases again.
  73. UBLIO_ITEMS     - 64. Higher increases speed of filesystem operations. Try 128.
  74. UBLIO_GRACE     - 32. Makes the cache items have more chances to be reused.
  75. UBLIO_SYNC_IO   - 0. If enabled, highly decreases writing speed, but the data
  76.                   is immediatly written to the disk.

  77. For example (improves performance over large files, but read below):

  78. # env UBLIO_BLOCKSIZE=2097152 ntfs-3g /dev/ad0s1 /mnt

  79. Alternatively these variables could be set in the shell startup file. For
  80. example if you are using it in /etc/fstab add them to /etc/profile. If you use
  81. it as a user, instead, editing the shell startup in HOME is enough.

  82. Note that higher values for UBLIO_BLOCKSIZE and UBLIO_ITEMS increase the
  83. memory usage by their product in bytes. For example, if you set it to 1MB it
  84. would consume 64MB. To decrease it to 16MB you could set UBLIO_BLOCKSIZE to
  85. 256KB (currently this is the default). Small values like 4096 can be used and
  86. also perform fine.

  87. It is also possible to enforce block aligned I/O on regular files by setting
  88. the FORCE_ALIGNED_IO variable (it will be set to 512 bytes), but this is only
  89. useful for testing purposes and in practice has no use.

  90. ==============================================================================
  91. 5. Known issues
  92. ==============================================================================

  93. When reading/writting the same file repeatedly while doing many simultaneous
  94. operations on different files sometimes the former one fails: read(2) returns
  95. -1 and sets errno to EAGAIN. This is because of a difference between the FUSE
  96. kernel implementation in Linux and FreeBSD, and is being worked on. An example
  97. scenario would be playing a song in XMMS, while building many ports, which
  98. could cause XMMS skip the song. Another observed problem is the current
  99. directory not being found, but entering again would work. The details are
  100. described in fuse4bsd (sysutils/fusefs-kmod) documentation (Linux access is
  101. path based while FreeBSD is vnode based, which may be reused).

  102. ==============================================================================
  103. 6. Reporting bugs
  104. ==============================================================================

  105. About the port itself, you can ask the maintainer (preferable) and/or in the
  106. ports@FreeBSD.org mailing list.

  107. About general NTFS problems (corruptions, etc) ask in the NTFS-3G forum (see
  108. below).

  109. But often (even on Linux, 50% of the issues are related to these) the problems
  110. reside on the FUSE implementation (the library itself, or fuse4bsd portion).

  111. For reporting kernel panics, see:

  112. http://fuse.sourceforge.net/wiki/index.php/DebugFreeBSDPanicsHowto

  113. And you can report them to the fuse4bsd author (preferable), or here:

  114. NTFS-3G forum:  http://forum.ntfs-3g.org/
  115. FreeBSD PRs:    http://www.freebsd.org/send-pr.html

  116. ==============================================================================
复制代码

论坛徽章:
29
技术图书徽章
日期:2013-09-02 19:59:502015元宵节徽章
日期:2015-03-06 15:51:332015小元宵徽章
日期:2015-03-06 15:57:20操作系统版块每日发帖之星
日期:2015-08-16 06:20:002015七夕节徽章
日期:2015-08-21 11:06:17操作系统版块每日发帖之星
日期:2015-09-21 06:20:002015亚冠之水原三星
日期:2015-10-30 00:06:07数据库技术版块每日发帖之星
日期:2015-12-24 06:20:0015-16赛季CBA联赛之上海
日期:2016-01-07 10:32:07操作系统版块每日发帖之星
日期:2016-01-08 06:20:00操作系统版块每日发帖之星
日期:2016-05-18 06:20:00IT运维版块每日发帖之星
日期:2016-07-23 06:20:00
7 [报告]
发表于 2012-08-29 11:30 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
8 [报告]
发表于 2012-08-29 11:31 |只看该作者
本帖最后由 ulovko 于 2012-08-31 19:24 编辑

Disk Setup On FreeBSD

FROM:  http://www.wonkity.com/~wblock/docs/html/disksetup.html

disksetup.pdf (124.45 KB, 下载次数: 18)

论坛徽章:
29
技术图书徽章
日期:2013-09-02 19:59:502015元宵节徽章
日期:2015-03-06 15:51:332015小元宵徽章
日期:2015-03-06 15:57:20操作系统版块每日发帖之星
日期:2015-08-16 06:20:002015七夕节徽章
日期:2015-08-21 11:06:17操作系统版块每日发帖之星
日期:2015-09-21 06:20:002015亚冠之水原三星
日期:2015-10-30 00:06:07数据库技术版块每日发帖之星
日期:2015-12-24 06:20:0015-16赛季CBA联赛之上海
日期:2016-01-07 10:32:07操作系统版块每日发帖之星
日期:2016-01-08 06:20:00操作系统版块每日发帖之星
日期:2016-05-18 06:20:00IT运维版块每日发帖之星
日期:2016-07-23 06:20:00
9 [报告]
发表于 2012-08-29 11:33 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
29
技术图书徽章
日期:2013-09-02 19:59:502015元宵节徽章
日期:2015-03-06 15:51:332015小元宵徽章
日期:2015-03-06 15:57:20操作系统版块每日发帖之星
日期:2015-08-16 06:20:002015七夕节徽章
日期:2015-08-21 11:06:17操作系统版块每日发帖之星
日期:2015-09-21 06:20:002015亚冠之水原三星
日期:2015-10-30 00:06:07数据库技术版块每日发帖之星
日期:2015-12-24 06:20:0015-16赛季CBA联赛之上海
日期:2016-01-07 10:32:07操作系统版块每日发帖之星
日期:2016-01-08 06:20:00操作系统版块每日发帖之星
日期:2016-05-18 06:20:00IT运维版块每日发帖之星
日期:2016-07-23 06:20:00
10 [报告]
发表于 2012-08-29 11:34 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP