FreeBSD下磁盘的分区格式化

其他Linux/Unix/BSD/OSX等发行版讨论
回复
头像
leavfin
帖子: 599
注册时间: 2012-01-12 13:32

FreeBSD下磁盘的分区格式化

#1

帖子 leavfin » 2012-08-06 5:18

fdisk默认是查看分区信息 类似linux下的fdisk -l
必须加参数-u 问答式的 要一步一步来不是很方便
好像单位也是默认的柱面 磁头 扇区 换算困难啊 也没发现-h参数
有没有更好的替代软件 不一定要图形,命令行也可以 只要好用

格式化方面 mkfs可以支持ext格式 当然安装其他工具也可以扩展
关键mkfs不支持fat格式 没有mkfs.vfat mkfs.msdosfs命令
这个在格式化U盘是是个问题
有一个newfs_msdos 好像可以 但是貌似没有用
还有newfs到底是什么功能
试验的时候 不小心把newfs /dev/da0s1 写成 ad0s1
那可是C盘啊 心想完蛋了 要重装windows了
谁知道重启以后一切正常 搞不明白了

以上是摸索出来的一些东西 还请高人指教 到底怎么弄分区 然后格式化
多谢各位了
头像
woodelf
帖子: 166
注册时间: 2010-05-25 10:26
系统: FreeBSD 9.1 amd64

Re: FreeBSD下磁盘的分区格式化

#2

帖子 woodelf » 2012-08-06 10:24

cfdisk,gpart
话说newfs就是格式化命令,你的情况可能是没执行成功。newfs只能直接格式化partition,估计无法直接格式化slice。
/dev/ada1:Gentoo Linux+ZFS (GPT)
/dev/ada2:FreeBSD 9.1+ZFS (GPT)
头像
leavfin
帖子: 599
注册时间: 2012-01-12 13:32

Re: FreeBSD下磁盘的分区格式化

#3

帖子 leavfin » 2012-08-06 14:06

woodelf 写了:cfdisk,gpart
话说newfs就是格式化命令,你的情况可能是没执行成功。newfs只能直接格式化partition,估计无法直接格式化slice。
freebsd里 slice不就是等同于partition的吗?
fdisk 分好以后应该有一个da0s1

%sudo fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=953 heads=64 sectors/track=32 (2048 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=953 heads=64 sectors/track=32 (2048 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 11 (0x0b),(DOS or Windows 95 with 32 bit FAT)
start 32, size 999999456 (488280 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 953/ head 63/ sector 32
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

可是/dev/里面却只有da0 没有da0s1


还有newfs竟然可以格式化da0

%sudo newfs /dev/da0
/dev/da0: 953.5MB (1952760 sectors) block size 32768, fragment size 4096
using 4 cylinder groups of 238.38MB, 7628 blks, 15360 inodes.
super-block backups (for fsck -b #) at:
192, 488384, 976576, 1464768

越来越不明白了
头像
woodelf
帖子: 166
注册时间: 2010-05-25 10:26
系统: FreeBSD 9.1 amd64

Re: FreeBSD下磁盘的分区格式化

#4

帖子 woodelf » 2012-08-06 14:22

leavfin 写了:
woodelf 写了:cfdisk,gpart
话说newfs就是格式化命令,你的情况可能是没执行成功。newfs只能直接格式化partition,估计无法直接格式化slice。
freebsd里 slice不就是等同于partition的吗?
fdisk 分好以后应该有一个da0s1

%sudo fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=953 heads=64 sectors/track=32 (2048 blks/cyl)

parameters to be used for BIOS calculations are:
cylinders=953 heads=64 sectors/track=32 (2048 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 11 (0x0b),(DOS or Windows 95 with 32 bit FAT)
start 32, size 999999456 (488280 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 953/ head 63/ sector 32
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>

可是/dev/里面却只有da0 没有da0s1


还有newfs竟然可以格式化da0

%sudo newfs /dev/da0
/dev/da0: 953.5MB (1952760 sectors) block size 32768, fragment size 4096
using 4 cylinder groups of 238.38MB, 7628 blks, 15360 inodes.
super-block backups (for fsck -b #) at:
192, 488384, 976576, 1464768

越来越不明白了
不,FreeBSD不一样,slice是等价于MBR分区表里面的主分区,slice上面再划分出来的才是partition。
关于newfs,我想我的解释没有错:
http://www.freebsd.org/cgi/man.cgi?quer ... &sektion=8
fdisk的用法也参考:
http://www.freebsd.org/cgi/man.cgi?fdisk
至于

代码: 全选

newfs /dev/da0
这个是直接在整块磁盘创建一个slice并且用UFS进行格式化了吧?
当然,我自己的是GPT,也就无需纠结于什么slice,partition了。从FreeBSD 9.0-RELEASE开始,推荐使用GPT分区表。
/dev/ada1:Gentoo Linux+ZFS (GPT)
/dev/ada2:FreeBSD 9.1+ZFS (GPT)
头像
leavfin
帖子: 599
注册时间: 2012-01-12 13:32

Re: FreeBSD下磁盘的分区格式化

#5

帖子 leavfin » 2012-08-06 14:28

没有用啊
newfs /dev/ad0s1 是格式化c盘 没成功 windows照常启动
newfs /dev/da0 是格式化u盘 没成功 dev里没da0s1
是需要另外配置呢 还是我系统哪里配置不对
用fdisk查看是有da0s1的
头像
woodelf
帖子: 166
注册时间: 2010-05-25 10:26
系统: FreeBSD 9.1 amd64

Re: FreeBSD下磁盘的分区格式化

#6

帖子 woodelf » 2012-08-06 14:34

对照newfs的man,加诸如-E参数试试,最好把系统环境交代下。
/dev/ada1:Gentoo Linux+ZFS (GPT)
/dev/ada2:FreeBSD 9.1+ZFS (GPT)
头像
leavfin
帖子: 599
注册时间: 2012-01-12 13:32

Re: FreeBSD下磁盘的分区格式化

#7

帖子 leavfin » 2012-08-06 14:39

woodelf 写了:对照newfs的man,加诸如-E参数试试,最好把系统环境交代下。
:em06
诶 怎么交代 不会啊
头像
woodelf
帖子: 166
注册时间: 2010-05-25 10:26
系统: FreeBSD 9.1 amd64

Re: FreeBSD下磁盘的分区格式化

#8

帖子 woodelf » 2012-08-06 14:41

leavfin 写了:
woodelf 写了:对照newfs的man,加诸如-E参数试试,最好把系统环境交代下。
:em06
诶 怎么交代 不会啊
诸如用什么介质启动,什么版本的FreeBSD,目标磁盘的分区结构,想要怎么分等等。
/dev/ada1:Gentoo Linux+ZFS (GPT)
/dev/ada2:FreeBSD 9.1+ZFS (GPT)
头像
leavfin
帖子: 599
注册时间: 2012-01-12 13:32

Re: FreeBSD下磁盘的分区格式化

#9

帖子 leavfin » 2012-08-06 14:47

9.0-RELEASE-p3 装在ad0s2 GENERIC内核
没做什么设置 基本只是装packages然后上上网什么的
想给给u盘分区 然后格式化成fat格式
没想到没有想的容易
头像
woodelf
帖子: 166
注册时间: 2010-05-25 10:26
系统: FreeBSD 9.1 amd64

Re: FreeBSD下磁盘的分区格式化

#10

帖子 woodelf » 2012-08-06 15:44

用newfs格式化之前要先把U盘卸载掉,看看是不是你的U盘自动挂到/media下面去了,所以无法格式化。
图片
/dev/ada1:Gentoo Linux+ZFS (GPT)
/dev/ada2:FreeBSD 9.1+ZFS (GPT)
头像
leavfin
帖子: 599
注册时间: 2012-01-12 13:32

Re: FreeBSD下磁盘的分区格式化

#11

帖子 leavfin » 2012-08-11 22:59

终于搞定了
gpart用来分区
newfs或者newfs_msdos用来格式化
fdisk太难搞了 还是gpart好用许多
头像
woodelf
帖子: 166
注册时间: 2010-05-25 10:26
系统: FreeBSD 9.1 amd64

Re: FreeBSD下磁盘的分区格式化

#12

帖子 woodelf » 2012-08-12 10:19

leavfin 写了:终于搞定了
gpart用来分区
newfs或者newfs_msdos用来格式化
fdisk太难搞了 还是gpart好用许多
欢迎进入FreeBSD的自由世界 :em04
/dev/ada1:Gentoo Linux+ZFS (GPT)
/dev/ada2:FreeBSD 9.1+ZFS (GPT)
回复