|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)7 m0 ]7 Q: \$ c( Q
or: fdisk /dev/sdc (for the third SCSI disk)
7 k& ^) L N4 \4 G or: fdisk /dev/eda (for the first PS/2 ESDI drive)
2 F* h" W- O1 @* i or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
1 U _+ `/ L. [! z% ] ...# C' E& U' ]% `6 Y. c) Z. W+ F
- df -k
5 B$ U5 ?$ c: n* E; } - df -lh: Y+ p8 _) z" [, |& _) l' m7 n
- 查看有几块硬盘:fdisk -l
' J! g( t9 B/ Q3 `# d( _" @* H
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 k! z# F' i5 H0 U( |
/dev/sda3 3723848 705968 2828716 20% /- l0 W( L6 U" s' a/ q4 I
/dev/sda1 101089 9274 86596 10% /boot
5 A/ x/ d) _7 L none 14520 0 14520 0% /dev/shm: G8 m( |; R2 g3 K( i M
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用 `+ m& {" j9 U3 z; S# z9 y
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel/ a; j) `' q8 T" r' v, J( g- X
Building a new DOS disklabel. Changes will remain in memory only,
0 W9 n, L: N( ^7 e. |7 T. P until you decide to write them. After that, of course, the previous
0 _) W% g& [0 s' D6 k content won't be recoverable.. q$ }1 F/ P! k ? N
The number of cylinders for this disk is set to 8322.' W, E8 n" A# Q
There is nothing wrong with that, but this is larger than 1024,
3 v; p9 D# _9 e- \' o and could in certain setups cause problems with:
+ B, Z, h$ b: N5 z6 g# \ 1) software that runs at boot time (e.g., old versions of LILO)7 g4 K+ b3 `( b; w5 G: i6 |9 P( r
2) booting and partitioning software from other OSs6 y8 q) a( Y8 Q! W v9 @. Z
(e.g., DOS FDISK, OS/2 FDISK)% F; P/ Q4 x0 C W! G$ {5 O
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)8 ^, S. L& T% \5 R0 M E
Command (m for help): p) u1 P+ g& k9 m! @7 T) O! U4 I5 {2 r
Disk /dev/hda: 4294 MB, 4294967296 bytes# s0 Z# \4 E& q! ]1 o$ V
16 heads, 63 sectors/track, 8322 cylinders" {9 n0 V0 Z: a
Units = cylinders of 1008 * 512 = 516096 bytes
6 Y+ }, M! m: D7 u* K3 r. P% ~% u- m1 Y Device Boot Start End Blocks Id System
2 j' M# G: V1 |* U Command (m for help): m* m ~. ?' U8 G7 b+ n$ P# J' Y
Command action; G- n: C5 \ h2 I3 |
a toggle a bootable flag& x3 ^2 B h9 P0 X' Q: J6 ]
b edit bsd disklabel& S" {& Y# w* l+ h" g6 ?
c toggle the dos compatibility flag9 Y% e* W" T0 ]3 Y" ?. Q8 ], O6 y
d delete a partition
/ Q: [. F2 x2 I4 ~6 m+ h3 r l list known partition types
9 Q1 Z8 A# e- W7 u( Q/ Z+ J% P m print this menu
- i4 h5 |$ }% Y- V n add a new partition9 H Q. D6 |0 y$ F# w' s# D
o create a new empty DOS partition table
9 { k, L3 ?7 ? p print the partition table; \0 c0 R5 v6 X: P" y, R
q quit without saving changes
) V/ @" j2 G4 \3 N% q$ u s create a new empty Sun disklabel
! d7 M( k) A9 N. f9 \ t change a partition's system id% f# F: J8 G3 c/ C0 m
u change display/entry units& y" {# l3 W7 c3 ]) K
v verify the partition table0 l( q, {0 q! H
w write table to disk and exit9 b' C/ R f7 g: f% ~. g
x extra functionality (experts only)
* i( g3 y" c z Command (m for help): n: z+ M) G. N+ T0 y1 B
Command action4 L9 l+ ]) [6 f% v) Q1 j. y
e extended2 v8 @$ |. W3 I1 ^- @, |* W9 x- N
p primary partition (1-4)
1 M$ N2 b* ~3 y; G p
: B: |0 p0 S) w Partition number (1-4): 1/ `% m+ h4 e3 \
First cylinder (1-8322, default 1):
9 I# q# J# r- u, {. k/ d9 E Using default value 19 \9 Q0 O- n/ a1 {5 O) v" {* v
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G: Q, O! a* J6 S; \; p% y$ K e
Command (m for help): p) A, J) g& X3 u/ t3 ]3 V5 U
Disk /dev/hda: 4294 MB, 4294967296 bytes$ l' l* C C) ]/ B& O
16 heads, 63 sectors/track, 8322 cylinders8 }% ~9 W, ^* R$ O" F7 a
Units = cylinders of 1008 * 512 = 516096 bytes& w0 |2 J0 R- j, f) G
Device Boot Start End Blocks Id System
3 h( i2 {5 [/ O2 j. e B /dev/hda1 1 1000 503968+ 83 Linux8 a- ^2 p; P* S; m9 `6 J& t& |
Command (m for help): w# C1 } }/ _& K" d% w& i/ D' U
The partition table has been altered!
4 r0 j* P4 h! ^% ]! w Calling ioctl() to re-read partition table.! }/ `( f$ J& z) M3 c$ ~* g+ s
Syncing disks.
8 P* Z( a3 a3 r ~5 Y2 n( j //格式化新分区. U% K. }2 f0 b; f" b* X0 `* Y
mke2fs 1.32 (09-Nov-2002)/ l, M* S H) Q2 z; d6 `, U
Filesystem label=- l1 A$ J1 x- h$ P7 F9 f; i
OS type: Linux% ^( ^6 T. _! ?, l. @
Block size=1024 (log=0)" N/ {3 C! K# c6 b8 S* f& a* T3 L6 G
Fragment size=1024 (log=0), \0 x. q. l' d* ^8 W
126480 inodes, 503968 blocks
& \; S! c# N' @# Y" `1 @ 25198 blocks (5.00%) reserved for the super user9 }9 U+ }5 \* V
First data block=15 h- k" F# z: ]7 y: t& A! k2 Z
62 block groups
o* R4 |* ?! y- P8 J1 I 8192 blocks per group, 8192 fragments per group( ]2 p4 F3 B% g8 q2 B; f
2040 inodes per group+ Y. d+ f* w3 X1 ?
Superblock backups stored on blocks: / \* O8 o5 ?0 W2 c8 a& Y7 d6 O2 i
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409" T; Y( z$ J. _! O6 ]. e
Writing inode tables: done
4 M0 f* ?. p' x( Z/ g `. a3 a @- ? Creating journal (8192 blocks): done ^/ Q6 M) y$ W0 u# x8 R
Writing superblocks and filesystem accounting information: done4 F- U2 r W8 f5 c* g3 t
This filesystem will be automatically checked every 30 mounts or
5 g/ X3 ]! w6 r7 U% V 180 days, whichever comes first. Use tune2fs -c or -i to override.
, b& L( i# m* K. ?3 p. l文件系统 1K-块 已用 可用 已用% 挂载点+ \. T+ e+ _' V
/dev/sda3 3723848 705992 2828692 20% /
: `; p0 j, A# G+ u+ ^0 A+ w /dev/sda1 101089 9274 86596 10% /boot1 |4 W$ x! c6 D: w0 X
none 14520 0 14520 0% /dev/shm
- F; m# d/ U; C% t. X; m2 n( C //挂上新分区
8 |" e7 R( y0 \: Z- mount /dev/hda1 /home
6 X! V# ^" A- J$ e6 g - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
2 \% J3 {* X" ^, y9 u* S8 R /dev/sda3 3723848 705992 2828692 20% /7 W* d) q7 X1 X; V, k5 |
/dev/sda1 101089 9274 86596 10% /boot" b+ g6 o" x- _8 ~9 x$ A' |. G( g
none 14520 0 14520 0% /dev/shm2 D# G2 g' `5 i7 N' ?. o; x
/dev/hda1 488006 8239 454569 2% /home# n" m1 d9 `8 v4 L) |
5 C. }) T2 d1 c l自动挂载:
2 ^& h' h4 v ~# S- vi /etc/fstab& h8 ]% B! w, c) ]7 i& \
- 9 B. b& _1 D e8 }& G y) r
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0) S( p6 _; G2 c3 L
- " d2 M h+ q; N
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
+ Q2 l; k" [/ }- M, Y. h4 x- mount /dev/sdb5 /mnt/ljp12 N) H9 N, t: i1 j( ^
- & n5 G X Z4 H7 K5 E
- mount /dev/sdb6 /mnt/ljp2
复制代码 2 q. Q$ C: B" r) y3 s
/ v8 C1 Y# J* S! G% \
" ]6 } Z, M: f0 m& R |
|