|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)' R! R: C1 A8 B7 W. S' j* \ k
or: fdisk /dev/sdc (for the third SCSI disk)( e8 y% y% n# n, r' c& \9 q
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
9 h7 @% H$ O( O" M. V1 d( ]2 z or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
& e0 f2 h% t- X0 i) |9 | ...) [ w" B. N' Q2 p+ C7 K' f# y1 G
- df -k! W: y# S* |6 Q
- df -lh4 b% z( I% ~% q4 ~7 k7 j; R
- 查看有几块硬盘:fdisk -l8 k3 K1 Z9 `" v h& h
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 v0 W6 c1 j5 g$ v' X
/dev/sda3 3723848 705968 2828716 20% /& ?: L' m6 H1 i- G
/dev/sda1 101089 9274 86596 10% /boot2 h6 \( O f4 ~! ]
none 14520 0 14520 0% /dev/shm$ h3 E, i3 l3 G% q& z
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用) C m: S/ a9 P# }2 i
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
/ a( Y" s. I# f; a1 ] Building a new DOS disklabel. Changes will remain in memory only,0 K8 _; J- K: X# G/ M% r5 ^4 k
until you decide to write them. After that, of course, the previous2 g- V& `1 ^4 A# `* X
content won't be recoverable.
/ Z& A' M# b' ~! |9 L" j0 s$ t The number of cylinders for this disk is set to 8322.
; `. u8 G- s& e$ T: v A; j2 r There is nothing wrong with that, but this is larger than 1024,* `7 w/ L# h2 b" ?! Y1 L% ]! d
and could in certain setups cause problems with:
: { v: X" F5 z! l% R$ g" t! B* y 1) software that runs at boot time (e.g., old versions of LILO); g9 A' R& r' W& I. [0 V
2) booting and partitioning software from other OSs
- L" V4 G( I1 A (e.g., DOS FDISK, OS/2 FDISK)
0 I# ] l3 J- g" E2 O Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)4 }- R) O0 I# R& U( q
Command (m for help): p
! y+ [2 r. I- K8 g* m! @' n Disk /dev/hda: 4294 MB, 4294967296 bytes
* u: u* f& P" g4 J- ` 16 heads, 63 sectors/track, 8322 cylinders, ^# w* C% a0 K4 c1 C1 g4 i
Units = cylinders of 1008 * 512 = 516096 bytes
/ ^. ?# Q9 M7 R t6 y Device Boot Start End Blocks Id System7 ]! T( k y2 k2 H( f/ x# d, ^
Command (m for help): m
O- d/ C6 r6 E3 x$ c/ x* a Command action
% B8 [% Q% z' B1 E1 d: t4 E a toggle a bootable flag- n9 x2 o- h9 U6 L, |) G; U3 m
b edit bsd disklabel. K$ k4 Y* r% O& a f
c toggle the dos compatibility flag7 f5 N8 f K/ l# p
d delete a partition
$ T4 E$ S" ?1 V" n2 a, j% h; O& c1 I l list known partition types8 p0 [* N' t: q4 G
m print this menu2 v8 D. K" g( O; L- w3 `
n add a new partition* i! p: i# z; s/ ^) P. E# _1 d. W! c1 u4 j
o create a new empty DOS partition table
) _; f3 w9 I' P" h: p7 `' W p print the partition table
) P& n. I+ q% z# E% o: L q quit without saving changes* ?1 d1 j; ?6 Y8 ?- K1 i
s create a new empty Sun disklabel' Z; C( e K9 {0 Q/ r. q6 D6 {
t change a partition's system id0 E; a. @6 j S2 G
u change display/entry units
# H3 }/ }4 V8 ] @& i v verify the partition table
/ y8 v6 z* i- j3 D w write table to disk and exit3 _. p. V1 k/ f' z. ^9 s
x extra functionality (experts only)( O0 h* c, d1 j/ T
Command (m for help): n
! v0 W r9 t6 w% P9 \ Command action/ k3 E- Z" x* A) }* M
e extended
2 x4 o) _" X. O2 M p primary partition (1-4)
' Q+ _- [; J8 v4 r, d- I p/ J/ g0 b( j* m
Partition number (1-4): 1
" V: C9 Y# H2 ]/ H& t: m* z z First cylinder (1-8322, default 1):
, A. J+ M. |2 l8 I$ ] Using default value 1# m* V& [% \( B; A- W
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
5 ]2 M+ P: X" j8 o# i Command (m for help): p4 l7 ]+ n# r O
Disk /dev/hda: 4294 MB, 4294967296 bytes
: Y1 @7 e B* A4 q2 e/ z2 r 16 heads, 63 sectors/track, 8322 cylinders2 e. Q0 g3 K% [; T
Units = cylinders of 1008 * 512 = 516096 bytes7 Y7 O2 n B2 T" U- Q* F, |
Device Boot Start End Blocks Id System
* E8 P( C# P2 s6 O6 e /dev/hda1 1 1000 503968+ 83 Linux7 J# ~5 y# `' _6 i9 ]3 J! c. O; r
Command (m for help): w6 C0 n" v" O# q4 k( }/ H5 H7 z
The partition table has been altered!
7 k: d A6 M V+ V* y6 j2 z- W' P Calling ioctl() to re-read partition table.9 C0 c3 F4 ~1 z8 d6 b3 L
Syncing disks.
; U2 X/ m- X \4 U0 @9 W //格式化新分区
6 y4 a" ~0 d: Z5 u" Gmke2fs 1.32 (09-Nov-2002)
$ M! y; y0 {5 \5 _. K" z1 U Filesystem label=
# H' Z8 G4 N+ q OS type: Linux( p X0 p0 e* H6 p1 K
Block size=1024 (log=0)+ ?3 W9 v6 n9 M3 w
Fragment size=1024 (log=0)
$ Z7 A- Y* _7 \# s9 ~9 f! L 126480 inodes, 503968 blocks
. l8 w$ D2 y% R# g3 r8 g 25198 blocks (5.00%) reserved for the super user
4 [7 w9 a7 W/ k/ q First data block=1
# w% y3 D( N- L3 `. V- F 62 block groups
) s0 E; _0 q ] 8192 blocks per group, 8192 fragments per group$ E9 d. ~) S% H: P7 B0 K4 L
2040 inodes per group
( J2 f) V8 V; K2 P Superblock backups stored on blocks: $ T, u9 j7 t6 F
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
" j, x! d% ? Z! M. p& b9 @ Writing inode tables: done X* f3 T8 c6 ?% T
Creating journal (8192 blocks): done
1 q! @" a0 \8 o8 ?% y% i0 k Writing superblocks and filesystem accounting information: done1 B7 a( G5 L5 C& {/ B! ] g: d$ k
This filesystem will be automatically checked every 30 mounts or
1 R+ Q: I+ i3 n6 ~( j 180 days, whichever comes first. Use tune2fs -c or -i to override.7 X4 R3 E4 K9 G8 {8 M
文件系统 1K-块 已用 可用 已用% 挂载点& M' a+ ~! ^$ \% k
/dev/sda3 3723848 705992 2828692 20% /1 Q# v8 t& a% n- u* v8 X
/dev/sda1 101089 9274 86596 10% /boot
" l# u5 O/ f6 S8 f. ~* f4 |0 q none 14520 0 14520 0% /dev/shm
" S' Y" W! d7 D4 c: t6 Z //挂上新分区! _, l( S! ^' [9 Q2 G; O7 @
- mount /dev/hda1 /home
1 D1 e$ g) W/ }: S - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点: ^8 L. P. F: d; l+ l
/dev/sda3 3723848 705992 2828692 20% // K% n9 h& N0 |, S; P, I. ?% w
/dev/sda1 101089 9274 86596 10% /boot
, S7 U( j0 N \6 ^7 t none 14520 0 14520 0% /dev/shm' L+ N3 j6 i: Q e) @6 i
/dev/hda1 488006 8239 454569 2% /home/ u( H# @- e8 y% g9 H
* k L: b7 J) |# B& Z) T自动挂载:
. Q$ ~- L5 ] T2 n- vi /etc/fstab$ q% w( O! Y' G/ p$ ?4 f, s$ d
- 2 `7 [4 C& w3 g( i# R% v4 q$ m
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
8 h7 m* a9 v# j& T
& ?6 V$ h/ U; {+ L/ o- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
8 }3 G$ T1 X6 E5 R+ k$ }+ K& f! q2 S- mount /dev/sdb5 /mnt/ljp1
! {5 ]% c8 @0 e; n3 p7 ~8 m
0 I1 h7 N; U1 e- [; r1 d% u- Y) N- mount /dev/sdb6 /mnt/ljp2
复制代码
% e; u2 ~/ Q$ n! O, b* V
# R3 B0 E- \: C: a2 t. Y* H
3 q* ~; _' S- w' o, G+ {9 b3 d |
|