|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
6 g. I3 X7 z8 Q' } or: fdisk /dev/sdc (for the third SCSI disk)
. B/ Y3 n6 g0 |! j% h" S9 i or: fdisk /dev/eda (for the first PS/2 ESDI drive)1 d) P# G! v! r+ k: j' g5 B
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
2 l" b: }+ d# O* D ...
+ Y$ B, `( |3 Y6 d* g0 o! ?- df -k
0 i- Z/ A% ^" S- C3 _2 Y - df -lh; j/ L6 _0 a" _8 q" }
- 查看有几块硬盘:fdisk -l
5 J2 c) x1 A* L9 u( }7 F6 t6 [, Z; N
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点$ j" Y, n2 [1 d! Q
/dev/sda3 3723848 705968 2828716 20% /
0 E% L3 t8 A' H! [9 W3 _+ g5 @ p- H /dev/sda1 101089 9274 86596 10% /boot F5 x/ r3 R6 Q
none 14520 0 14520 0% /dev/shm) v5 e, M: }" ?& g4 |- z6 }3 F
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
. A) B! y T0 w" E. c" EDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel( J p& C+ c& i- ^. R
Building a new DOS disklabel. Changes will remain in memory only," `7 X1 q) [# ~6 G6 x1 ^
until you decide to write them. After that, of course, the previous6 {1 v. p, f+ |7 @. ^. ?
content won't be recoverable.
/ M5 D* _' M. L& o( C' B1 J The number of cylinders for this disk is set to 8322.
/ H4 _9 b) Z, M! Z; w There is nothing wrong with that, but this is larger than 1024,
3 U4 K q8 x9 s9 Z and could in certain setups cause problems with:
; B9 s/ X- S* r8 w0 H2 _ 1) software that runs at boot time (e.g., old versions of LILO)! A/ a( j0 z* t4 Q& }4 s: q
2) booting and partitioning software from other OSs1 J7 Y, M1 u# C4 T( |: I( K7 s
(e.g., DOS FDISK, OS/2 FDISK)
1 x# g" A& q; B+ T5 @; B Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)5 T3 N/ G' ^1 X' A! O; z! y
Command (m for help): p/ b% |& f' ]& P
Disk /dev/hda: 4294 MB, 4294967296 bytes
# X5 V4 ]1 H6 T# A* \( ~8 x3 l 16 heads, 63 sectors/track, 8322 cylinders* j3 E# d/ z9 u4 b
Units = cylinders of 1008 * 512 = 516096 bytes7 q/ _( M. P: y- H5 Y& n4 B& B- K6 k
Device Boot Start End Blocks Id System5 |7 Z0 ]3 Y6 M" I; y# x& t
Command (m for help): m7 o! ?2 z! A7 O ]* c% D1 N S
Command action4 P0 ^# I3 u5 O0 T* h) e- n% q. F
a toggle a bootable flag$ K' N7 | X- a9 E# I5 Z. q# b
b edit bsd disklabel
3 o+ R! k K h# \3 F c toggle the dos compatibility flag( W* f+ d' M- M j3 O6 r
d delete a partition5 r, t1 j" d( ]# W$ j; @
l list known partition types) S$ k: T0 l9 q6 |6 H
m print this menu( m/ c3 D4 W- ]
n add a new partition
* N5 s1 h# J. }! D5 ~0 I* f/ e o create a new empty DOS partition table+ {) U/ i6 M4 n0 y& F1 y4 ?- o
p print the partition table8 H# I7 b. ]$ i! H B" [* s& Y
q quit without saving changes& X; m' Z) r$ o! K
s create a new empty Sun disklabel
) R5 Y5 l# T& u& u d; @ t change a partition's system id
: D8 q) h& v& D# H u change display/entry units
# g6 h* Q0 ]0 N7 i: z; _ v verify the partition table
. J1 X6 Y' v; R' X, j: z* ^7 Q# O w write table to disk and exit$ x3 J+ ?$ H+ g2 ]
x extra functionality (experts only) R \% ]" y1 e3 h$ v# m
Command (m for help): n
! p/ j$ R' k$ a8 k1 D Command action- R3 d# y! s. o8 b" ]
e extended
+ r' g X5 u- \1 j p primary partition (1-4)& U! U. Y: D/ y) M) S1 U
p
# G1 \) X8 O& \2 a0 S3 ]" W3 R Partition number (1-4): 1/ u: r5 e5 x2 O- Y$ y5 {2 g- Z
First cylinder (1-8322, default 1):
8 }( N) X$ E4 P8 C% w Using default value 1$ M4 C0 l: {5 W6 O( S7 b# I
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
) N1 }. ~7 }9 } Command (m for help): p
; |2 m& a' Q4 f% ?5 q4 ]$ Y Disk /dev/hda: 4294 MB, 4294967296 bytes
( ]8 O% T: {8 S; a# b 16 heads, 63 sectors/track, 8322 cylinders0 l! z& s3 o0 @/ ]3 f
Units = cylinders of 1008 * 512 = 516096 bytes' y, E! i) S. K9 v0 N0 e6 |
Device Boot Start End Blocks Id System1 t% f7 z; S O i' L9 G
/dev/hda1 1 1000 503968+ 83 Linux5 O: t6 V3 b" B* a
Command (m for help): w, @2 W, j! f! O9 n( j
The partition table has been altered!
" P7 a1 y/ d: V7 f/ a Calling ioctl() to re-read partition table.
' S5 _' d6 I/ ~# l7 {% h8 j Syncing disks.9 Z, \! I, O: t/ _1 R1 y
//格式化新分区' d1 N8 M, o' @ {7 @
mke2fs 1.32 (09-Nov-2002): i) M! b8 s% s6 m6 d0 |# t
Filesystem label=
& Y0 V! F7 |. P O. Y) b OS type: Linux, N( k0 `" \( z( c" N
Block size=1024 (log=0), s% k9 Z5 Q0 x( @: ?
Fragment size=1024 (log=0)0 o5 w5 S# }1 D1 y- p5 Y8 h3 S, g0 z
126480 inodes, 503968 blocks! q( @8 d2 g' r
25198 blocks (5.00%) reserved for the super user2 R0 @$ O- @, b# n+ ~
First data block=1* w# n8 B- I# V3 x) _
62 block groups
2 `/ S: q B# c 8192 blocks per group, 8192 fragments per group+ ~ \) y' B4 i3 o9 z
2040 inodes per group, H- E( N9 O: @) i2 {. {8 s
Superblock backups stored on blocks:
P1 T. {- _: Z* s2 T# [* R 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409' O# q2 a1 F) @' V; }
Writing inode tables: done
; N. a6 `' ~* p2 G+ a- v Creating journal (8192 blocks): done- S$ a: R( {+ e2 {, X
Writing superblocks and filesystem accounting information: done
3 m1 p6 e1 l3 n1 s: N: \2 h: W+ I3 _9 [ This filesystem will be automatically checked every 30 mounts or. K8 ]: N9 `; C! I
180 days, whichever comes first. Use tune2fs -c or -i to override.: l: e. W) p8 _: ^: W- R
文件系统 1K-块 已用 可用 已用% 挂载点 M* y7 W, o1 m- f" a8 G- |
/dev/sda3 3723848 705992 2828692 20% /
4 j. `/ `$ b5 Z4 h" Y! F3 f! M /dev/sda1 101089 9274 86596 10% /boot
j, r) ? }, t* y( O none 14520 0 14520 0% /dev/shm
7 E/ Q- j2 I% `7 N //挂上新分区& d B/ _; k$ S( {3 D
- mount /dev/hda1 /home
T7 l& G) G; r( Z - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
9 |4 k2 o) q! W8 a: Q3 E /dev/sda3 3723848 705992 2828692 20% /6 L0 f6 O2 f. h# v
/dev/sda1 101089 9274 86596 10% /boot$ |8 s5 D" Q$ ~! u' A1 s
none 14520 0 14520 0% /dev/shm6 o( S4 g) ^- X/ `2 F( f
/dev/hda1 488006 8239 454569 2% /home
T8 ?# Y6 ?, v9 s* @( J0 A1 e& }% I3 D1 W
自动挂载:! ]0 X) h4 g$ c( u! P
- vi /etc/fstab
2 |! K) O0 I9 Z5 ^ - 6 j/ D4 g% T) I
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
( H4 h4 R- {( ~: P0 T$ h# _
) i0 C. L9 P# m! y2 F- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
* q4 c- T7 I9 ~; W4 Y- o" B% o5 ]- mount /dev/sdb5 /mnt/ljp1
# \+ Z7 j9 k }$ e+ m
0 `( `1 `. s: }" X- mount /dev/sdb6 /mnt/ljp2
复制代码 - L- _ F6 ?! b, {/ [
3 @# L" C V4 j2 S
+ |7 T3 N& [2 Q8 Z4 O8 p+ x |
|