|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)6 J! f# |8 o$ `; u
or: fdisk /dev/sdc (for the third SCSI disk)
3 b! W8 Q% v1 v( A or: fdisk /dev/eda (for the first PS/2 ESDI drive)
3 n0 H* a; ?& l9 f7 ?$ M3 { K! P K( a or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
; H7 V7 A* i4 g8 X# h ...
# z; {, {' D/ O9 q: b# O- df -k! z3 [- @# ?0 x% m
- df -lh6 I0 r* g" A# w4 D1 @9 B+ h; y
- 查看有几块硬盘:fdisk -l
8 g9 i7 V8 V a& v
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
% i: q. R* O( b/ L' _5 L: v, R) _ /dev/sda3 3723848 705968 2828716 20% /
6 k# j8 Z5 E) A( o: z* w7 ^ /dev/sda1 101089 9274 86596 10% /boot
`' \+ g' k2 s) k' W0 j) H none 14520 0 14520 0% /dev/shm) O. u6 t4 {$ i0 u' ?
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用) t( z- V0 S+ k$ c. x5 }
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel- U' {! t! m! D1 s9 B0 t
Building a new DOS disklabel. Changes will remain in memory only,
+ ~; Q- ] H, d- V! R' b until you decide to write them. After that, of course, the previous
0 n- s( N, I, R: D1 f content won't be recoverable." `8 d8 Q! w. B$ V2 x+ Q: O
The number of cylinders for this disk is set to 8322.
2 Z' I: K6 e3 `/ l There is nothing wrong with that, but this is larger than 1024,
/ V) P3 n2 Y, O7 c, s: n+ o2 M, Q# ] and could in certain setups cause problems with:; [5 |$ i5 Y+ i1 t3 p
1) software that runs at boot time (e.g., old versions of LILO)/ M3 T0 S h+ `9 w4 z& E: i3 }! J3 A
2) booting and partitioning software from other OSs
0 Q! C( I3 m5 n# o- W (e.g., DOS FDISK, OS/2 FDISK)8 }, d8 ^' h* h( M4 ~
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)- g, Z5 s, i/ `+ r k" o
Command (m for help): p
$ d% ?/ M; T4 k/ v6 f( c: F8 i% o5 u0 U Disk /dev/hda: 4294 MB, 4294967296 bytes6 y" k1 @" `% E$ j5 q
16 heads, 63 sectors/track, 8322 cylinders9 i% d- A3 L! |8 T! M6 p& N- b- Q
Units = cylinders of 1008 * 512 = 516096 bytes
: B; r" l! F& q- o Device Boot Start End Blocks Id System
6 S5 { q) L k- O' U* J: d Command (m for help): m& F0 c5 M8 B+ f9 H `" o3 Y6 i0 i( C
Command action
, y( h& l7 E) X: s3 Q a toggle a bootable flag
2 T$ c- C6 I% W% U b edit bsd disklabel5 w1 P0 Q& U( @# w
c toggle the dos compatibility flag+ R, u7 c& N: l
d delete a partition
$ A9 z. \ p; U- S* S l list known partition types+ r9 X4 c. k3 R! h2 R
m print this menu: @: k8 X" v3 q0 C( l; G
n add a new partition
4 A/ r( M# E* O/ U# A0 c# V4 ^' I o create a new empty DOS partition table2 @- e* ]8 o" `; W( E7 |6 K* @" p
p print the partition table4 u h v* A. X/ W$ L9 z2 L
q quit without saving changes
9 V7 }( {- {3 h2 R7 K s create a new empty Sun disklabel4 X4 K* E1 c1 u% z; L# ^! M, M4 d
t change a partition's system id/ w/ P0 `0 }0 w/ `7 M
u change display/entry units# K- R5 j, o, m+ R
v verify the partition table4 d: o% Z7 K4 L, s) P0 g u6 h1 }
w write table to disk and exit! h' X4 {6 [6 B- Q# Z
x extra functionality (experts only)0 t& B6 ~" b4 ~2 `
Command (m for help): n6 d+ ~$ W! T. ]
Command action5 B: O7 A$ |0 x, n5 A
e extended/ p1 u% B4 [9 D' ^
p primary partition (1-4)$ ~( r8 d Z% A; r7 s" b0 u: B' a
p
! W7 r8 o; J! k+ p Partition number (1-4): 1
2 P( B6 z; h+ G/ \ First cylinder (1-8322, default 1): 7 v6 \+ T6 o8 V$ C
Using default value 14 I+ N$ c& I# I
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G# f0 [4 d" E# r& X
Command (m for help): p9 h) T/ f' A- A" L
Disk /dev/hda: 4294 MB, 4294967296 bytes
1 n' }7 O# h3 O7 R+ p5 C& R 16 heads, 63 sectors/track, 8322 cylinders) a2 Z7 x* g: u! [- q* [
Units = cylinders of 1008 * 512 = 516096 bytes+ `1 i( O9 j+ d2 J) |$ U
Device Boot Start End Blocks Id System
; k; d+ G9 k" a' Y1 \* H2 } /dev/hda1 1 1000 503968+ 83 Linux3 ^$ u3 \8 N1 t8 G- V1 K0 }
Command (m for help): w" U0 Z5 s& Y8 |: p$ m- Z; R
The partition table has been altered!
$ w6 y% \1 @$ c. s Calling ioctl() to re-read partition table.
, z& a9 S8 ]' Q6 X- l5 i- i Syncing disks.9 X1 I7 h& u6 K% x; g
//格式化新分区
0 f0 P+ L$ i! l/ wmke2fs 1.32 (09-Nov-2002). X4 l2 t( b$ ^2 \
Filesystem label=
5 L. i" O2 f) s2 Y" @& W OS type: Linux& c- i( y6 z# @/ w( \/ X7 W5 K8 I L# h
Block size=1024 (log=0)* }* p% U% V) t8 b" n
Fragment size=1024 (log=0)9 b4 E8 ]2 Z, ?* @) i# J* q2 H/ k
126480 inodes, 503968 blocks' g" u! T2 F5 {2 e8 p+ J
25198 blocks (5.00%) reserved for the super user
6 f" X, \+ w: j( a7 p; \1 H First data block=1
' Z8 V& s! W+ F2 }5 M- [ 62 block groups- {# E/ v& |4 P; X# C- X- O, \* b
8192 blocks per group, 8192 fragments per group4 J9 S" R! a8 K
2040 inodes per group _8 m) W5 G* y4 \
Superblock backups stored on blocks: ! ?7 j2 l( r/ r1 i
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014093 I+ m! ^1 w6 D
Writing inode tables: done + k( e6 d# u' I. s3 b
Creating journal (8192 blocks): done D D) q& H, P9 W; I6 Q, V
Writing superblocks and filesystem accounting information: done6 X5 b. j+ }; y5 U5 `0 A/ U
This filesystem will be automatically checked every 30 mounts or
. `% X! q: N8 w 180 days, whichever comes first. Use tune2fs -c or -i to override., r4 {. ^* O! `! h
文件系统 1K-块 已用 可用 已用% 挂载点1 a+ o' \6 k& [9 |" B3 n
/dev/sda3 3723848 705992 2828692 20% /
2 I: _& c$ Z8 q3 ]' _6 c /dev/sda1 101089 9274 86596 10% /boot7 e( v! B# h0 |
none 14520 0 14520 0% /dev/shm
! J$ ?6 w( _" q2 }; c //挂上新分区, ^, d7 @6 b- X
- mount /dev/hda1 /home) ^+ Y) l! N; A, C6 R
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
& I6 v/ A( I8 }) m /dev/sda3 3723848 705992 2828692 20% /. a, e( W$ M) o0 o
/dev/sda1 101089 9274 86596 10% /boot1 X+ l2 `" L! e. M2 C$ v
none 14520 0 14520 0% /dev/shm" A4 B, Z( P3 g" h% w3 R7 w7 b T8 ~
/dev/hda1 488006 8239 454569 2% /home
9 G/ o6 e) o/ v3 H% U/ w8 O. D5 D& v; U! L- k% ^
自动挂载:
8 ~, J$ I M4 h- vi /etc/fstab$ q; V; b& D' q, o: x9 E* p
- / w$ i1 s* ^# }% F8 o* u9 V
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
: `; M/ C. A: U5 m - 8 \: R+ i+ [; w
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:( Z: T6 J* n6 L1 ~% ^# k: N3 }
- mount /dev/sdb5 /mnt/ljp1
% J! Z) V5 C: C8 W
5 H. \0 h1 z! \( X: J- mount /dev/sdb6 /mnt/ljp2
复制代码
' A% H6 E1 N1 Z1 Y) x( R$ X: ]0 z' c% c4 B, c) A- ^
& W' B+ J, ^4 l, O% f* H! D8 W ] |
|