before I started:
/dev/da0: 91517 cyl 255 hd 63 sec
Part Start Size Type Flags
1: 63 980141652 0xa5 0×80
root@mybox:data# disklabel -A /dev/da0s1
# /dev/da0s1:
type: unknown
disk: amnesiac
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 61010
sectors/unit: 980141652
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 980141636 16 4.2BSD 2048 16384 28528
c: 980141652 0 unused 0 0 # “raw” part, don’t edit
root@mybox:data# fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=91517 heads=255 sectors/track=63 (16065 blks/cyl)
Figures below won’t work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=91517 heads=255 sectors/track=63 (16065 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 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 63, size 980141652 (478584 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 594/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
as I use the whole disk as one slice, I use the “-I” option of fdisk:
******* Working on device /dev/da0 *******
root@mybox:ddliu# fdisk /dev/da0
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=91517 heads=255 sectors/track=63 (16065 blks/cyl)
Figures below won’t work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=91517 heads=255 sectors/track=63 (16065 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 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 63, size 1470220542 (717881 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 380/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
root@mybox:ddliu# fdisk -s /dev/da0
/dev/da0: 91517 cyl 255 hd 63 sec
Part Start Size Type Flags
1: 63 1470220542 0xa5 0×80
Note the device should be umounted. Else fdisk won’t work.
Now let’s take a look at the output of disklabel:
# /dev/da0s1:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 980141636 16 4.2BSD 2048 16384 28528
c: 980141652 0 unused 0 0 # "raw" part, don’t edit
disklabel: partition c doesn’t cover the whole unit!
disklabel: An incorrect partition c may cause problems for standard system utilities
root@mybox:ddliu# disklabel -A /dev/da0s1
# /dev/da0s1:
type: unknown
disk: amnesiac
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 61010
sectors/unit: 980141652
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 980141636 16 4.2BSD 2048 16384 28528
c: 980141652 0 unused 0 0 # “raw” part, don’t edit
Now use disklabel (bsdlabel) to. use -n for a test first. Note the partition a is 16 sectors short than partition c. after that, this becomes:
# /dev/da0s1:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 1470220526 16 4.2BSD 2048 16384 28528
c: 1470220542 0 unused 0 0 # "raw" part, don’t edit
root@mybox:ddliu# disklabel -A /dev/da0s1
# /dev/da0s1:
type: unknown
disk: amnesiac
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 91516
sectors/unit: 1470220542
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 1470220526 16 4.2BSD 2048 16384 28528
c: 1470220542 0 unused 0 0 # “raw” part, don’t edit
now time to growfs:
We strongly recommend you to make a backup before growing the Filesystem
Did you backup your data (Yes/No) ? Yes
new file systemsize is: 367555131 frags
Warning: 188332 sector(s) cannot be allocated.
growfs: 717789.1MB (1470032192 sectors) block size 16384, fragment size 2048
using 3907 cylinder groups of 183.72MB, 11758 blks, 23552 inodes.
with soft updates
super-block backups (for fsck -b #) at: growfs -s 1470220526 /dev/da0s1a
Note the answer must be “Yes”, but not “yes”. I think I can omit the “-s” option.
Now I can mount it back and do fsck. Looks everything is good.
Hmmm, there are two things looks wired:
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad2s1a 507630 55412 411608 12% /
devfs 1 1 0 100% /dev
/dev/ad2s1g 187127256 541878 171615198 0% /home
/dev/ad2s1e 1012974 68 931870 0% /tmp
/dev/ad2s1f 30462636 6652302 21373324 24% /usr
/dev/ad2s1d 10154158 14736 9327090 0% /var
/dev/da0s1a 474649096 500328 436176842 0% /mnt/data
The disk space does not grow. And what’s the warning in the growfs output? Let’s do a reboot.
OK, the key is, before growfs, it’s better to do a fsck to make sure the consistent of the partition. It failed last time because it was not properly dismounted before
Now everything looks good:
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=91517 heads=255 sectors/track=63 (16065 blks/cyl)
Figures below won’t work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=91517 heads=255 sectors/track=63 (16065 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 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 63, size 1470220542 (717881 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 380/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
root@mybox:ddliu# fdisk -s /dev/da0
/dev/da0: 91517 cyl 255 hd 63 sec
Part Start Size Type Flags
1: 63 1470220542 0xa5 0×80
root@mybox:ddliu# disklabel /dev/da0s1
# /dev/da0s1:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 1470220526 16 4.2BSD 2048 16384 28528
c: 1470220542 0 unused 0 0 # “raw” part, don’t edit
root@mybox:ddliu# disklabel -A /dev/da0s1
# /dev/da0s1:
type: unknown
disk: amnesiac
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 91516
sectors/unit: 1470220542
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
a: 1470220526 16 4.2BSD 2048 16384 28528
c: 1470220542 0 unused 0 0 # “raw” part, don’t edit
root@mybox:ddliu# df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad2s1a 507630 55412 411608 12% /
devfs 1 1 0 100% /dev
/dev/ad2s1g 187127256 541878 171615198 0% /home
/dev/ad2s1e 1012974 68 931870 0% /tmp
/dev/ad2s1f 30462636 6652302 21373324 24% /usr
/dev/ad2s1d 10154158 14746 9327080 0% /var
/dev/da0s1a 711886514 500328 654435266 0% /mnt/data
Now I’ll create a new FS on the same disk from /stand/sysinstall and see if they are the same.
now the “official” output
******* Working on device /dev/da0 *******
parameters extracted from in-core disklabel are:
cylinders=91517 heads=255 sectors/track=63 (16065 blks/cyl)
Figures below won’t work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=91517 heads=255 sectors/track=63 (16065 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 165 (0xa5),(FreeBSD/NetBSD/386BSD)
start 63, size 1470220542 (717881 Meg), flag 80 (active)
beg: cyl 0/ head 1/ sector 1;
end: cyl 1023/ head 254/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
root@mybox:ddliu# fdisk -s /dev/da0
/dev/da0: 91517 cyl 255 hd 63 sec
Part Start Size Type Flags
1: 63 1470220542 0xa5 0×80
root@mybox:ddliu# disklabel /dev/da0s1
# /dev/da0s1:
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
c: 1470220542 0 unused 0 0 # “raw” part, don’t edit
d: 1470220542 0 4.2BSD 2048 16384 28528
root@mybox:ddliu# disklabel -A /dev/da0s1
# /dev/da0s1:
type: SCSI
disk: da0s1
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 91517
sectors/unit: 1470234624
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0 # milliseconds
track-to-track seek: 0 # milliseconds
drivedata: 0
8 partitions:
# size offset fstype [fsize bsize bps/cpg]
c: 1470220542 0 unused 0 0 # “raw” part, don’t edit
d: 1470220542 0 4.2BSD 2048 16384 28528
disklabel: partition c doesn’t cover the whole unit!
disklabel: An incorrect partition c may cause problems for standard system utilities
root@mybox:ddliu# df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad2s1a 507630 55412 411608 12% /
devfs 1 1 0 100% /dev
/dev/ad2s1g 187127256 541878 171615198 0% /home
/dev/ad2s1e 1012974 68 931870 0% /tmp
/dev/ad2s1f 30462636 6652302 21373324 24% /usr
/dev/ad2s1d 10154158 14748 9327078 0% /var
/dev/da0s1d 711974768 4 655016784 0% /mnt/data
Now the difference:
the cyl numbers reported by fdisk are different. And my “manual” growfs don’t know the type of /dev/da0s1. I guess this is because I didn’t use the “official” tool to partition before the growfs, and I was not familiar with the command line either at that time.
I think it’s fine now. I’ll build the production target with RAID5 of 3 disks and initialize it with the official tool.
Tags: freebsd, file system
Post a Comment
You could use <code type="name"> to get your code colorized