|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
& ~' z, U5 z# ^% `( n) O/ N or: fdisk /dev/sdc (for the third SCSI disk): J% J9 { F @+ f! f2 E$ x0 m
or: fdisk /dev/eda (for the first PS/2 ESDI drive), i1 I2 T$ r' Y8 @7 G
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)" K5 y3 D1 i2 D+ s( D3 Z' a
...5 I M' ^3 p* O0 g
- df -k
( J) F9 ^$ Q% o. A - df -lh/ o" H$ x( Q. Z1 h5 S9 q+ F
- 查看有几块硬盘:fdisk -l2 B: }3 x! j7 @6 Y+ `' R9 U5 R
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
, W9 x- h$ E- [& s /dev/sda3 3723848 705968 2828716 20% /& Y7 {* D# b, F Y
/dev/sda1 101089 9274 86596 10% /boot
8 C) ?$ u# r& T+ Q) T none 14520 0 14520 0% /dev/shm
& |9 G( j& u+ c( `, H/ o 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用! f [2 C! E& u5 Q
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
/ g' b! \/ T! ^% N3 B. N Building a new DOS disklabel. Changes will remain in memory only,2 o4 Z7 `4 |& C/ T8 V1 w
until you decide to write them. After that, of course, the previous: I# z7 i" p) ~+ x' s
content won't be recoverable.' K& e( l8 Y' x: @
The number of cylinders for this disk is set to 8322.
- t! q a" o1 S! i* B5 O7 i+ Y- b There is nothing wrong with that, but this is larger than 1024,
6 z: E4 ]; N+ d" U$ z and could in certain setups cause problems with:
2 s4 e- S' Z$ _) S 1) software that runs at boot time (e.g., old versions of LILO)
1 R+ g/ V+ s+ o- K 2) booting and partitioning software from other OSs
3 p: V2 D( b% u9 a$ Z (e.g., DOS FDISK, OS/2 FDISK)
/ Q& Z. G% u, l/ ] Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)" W9 | Y0 Y9 p5 o: d+ W3 e! d
Command (m for help): p
9 ?" j: ^3 F0 c) D. Y Disk /dev/hda: 4294 MB, 4294967296 bytes; c k" o5 \ i- U1 F
16 heads, 63 sectors/track, 8322 cylinders
! v1 N c3 l4 ~5 G( e Units = cylinders of 1008 * 512 = 516096 bytes/ w+ m- }3 }& S) i5 ~6 v e/ X
Device Boot Start End Blocks Id System
& C8 L! E* ]% u, g$ E2 B Command (m for help): m
! V4 p* @8 E! B2 u4 ]' ~- Z Command action* {4 u3 Z. ]5 t, W3 R
a toggle a bootable flag
! p3 L) y/ n1 C7 d( ~7 d5 o b edit bsd disklabel
5 z0 m& B+ r6 C9 e5 S- i- q" z- V c toggle the dos compatibility flag, T; X, @$ M% Z- V
d delete a partition7 W- ~( R1 U: E
l list known partition types2 Q" u" j6 `7 K: R) [2 ]
m print this menu- _5 {/ W% R2 `6 U* {8 i
n add a new partition
# o$ w) @# T% q8 Q o create a new empty DOS partition table
, t! u( y5 V7 ? p print the partition table' ?) G! V+ ~, F9 Y3 i, h
q quit without saving changes
0 P9 T, ~5 g+ |% ~8 Q1 B: N s create a new empty Sun disklabel$ K1 r, g4 G/ y0 j# \* m& P& a7 ?
t change a partition's system id
0 G9 }. x7 d% s; r u change display/entry units! `7 r W; n0 j: E
v verify the partition table" n4 c$ W+ ?& q3 W- l9 U
w write table to disk and exit
% C8 k9 b4 ]/ E# c x extra functionality (experts only)4 Y& w) ]3 b _ p5 ?9 E7 Y* M- c
Command (m for help): n
$ i9 g$ b) _/ z: s# |) { Command action
7 o: Y+ D8 s1 c" n e extended
* t7 ], ], p% o6 t! q8 v1 ] p primary partition (1-4)
( }9 h# g0 b+ A; f. K. F p
1 R2 [* x* e1 t# F$ { Partition number (1-4): 1
- ?6 J9 `9 Y9 |) V/ S7 z) z' z9 ~3 B First cylinder (1-8322, default 1):
7 P, M3 }" Y6 X t. w Using default value 1- e9 L# K" a6 g, t1 I& Y
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
, Z% y0 n2 x! X! Z9 e7 W: { Command (m for help): p
+ P% V* b/ z* r' V) S+ B Disk /dev/hda: 4294 MB, 4294967296 bytes
) o1 ?+ L3 ^4 ] 16 heads, 63 sectors/track, 8322 cylinders; N; @6 Y2 u4 ?- c8 B( K# ~
Units = cylinders of 1008 * 512 = 516096 bytes: g; }3 |% Z5 M0 X7 n* x
Device Boot Start End Blocks Id System S" U5 D9 d) |7 R6 X# r! P
/dev/hda1 1 1000 503968+ 83 Linux
* T5 D s( u. z7 Z' j Command (m for help): w( Q7 D1 B! |7 q& y
The partition table has been altered!/ [* R6 C. U8 J& q4 H; M$ t
Calling ioctl() to re-read partition table.
R/ _# H5 R( D$ r1 F; I Syncing disks.
2 J8 u2 Z% _( G! E. e% E //格式化新分区7 f- @9 X$ k" `- S
mke2fs 1.32 (09-Nov-2002)
4 z0 X1 I% Z% `9 g+ J& E9 c Filesystem label=( j+ P; R& I# B6 j3 Z" Q
OS type: Linux
/ Q/ p# a4 E/ | Block size=1024 (log=0)" {, q4 r2 q3 }. g7 f
Fragment size=1024 (log=0)
+ M) t3 \, e: u H# }! x 126480 inodes, 503968 blocks
) r4 N' a! q1 f 25198 blocks (5.00%) reserved for the super user6 H* W: S3 u( }2 f$ }/ E' G+ }8 A
First data block=1
( x- R% R4 u% e: w 62 block groups" b* l( Q: M8 s; d
8192 blocks per group, 8192 fragments per group
" k9 R2 t! v$ e; \- ^1 r 2040 inodes per group
2 n8 {. V% K1 R6 C! W: O' e Superblock backups stored on blocks:
0 G% o/ ^, {. g# Y- Y }' d 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
( i" j3 l7 k6 J! f1 ~* o/ y& i! D: ]7 H Writing inode tables: done ( v' }) g+ [5 x( Q' i$ K8 C% n7 m' W
Creating journal (8192 blocks): done
9 |0 L4 J7 F+ j2 k' C: R Writing superblocks and filesystem accounting information: done9 Z/ A5 T1 S/ T( E: T
This filesystem will be automatically checked every 30 mounts or
! B1 R1 Z" X8 M( j5 Y( y: ^. s 180 days, whichever comes first. Use tune2fs -c or -i to override.: i( i1 S- t: l1 W6 r' V
文件系统 1K-块 已用 可用 已用% 挂载点0 m( \- X, |3 n8 ^0 E
/dev/sda3 3723848 705992 2828692 20% /
3 h) ?3 G" Q) X" M1 i w, p /dev/sda1 101089 9274 86596 10% /boot
- F$ J7 q! G6 G+ k; l& C none 14520 0 14520 0% /dev/shm; C r7 K e: z7 Y
//挂上新分区
5 x, }( g2 O9 H; R- mount /dev/hda1 /home0 ]- A$ |( h# z, H: g' o
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点- m) D+ Q' F, Z" d: {3 C
/dev/sda3 3723848 705992 2828692 20% /
* h2 [8 E" p D H9 G+ J2 z /dev/sda1 101089 9274 86596 10% /boot
: r/ T" ^) E: f3 D- V/ f none 14520 0 14520 0% /dev/shm
+ A6 r/ w8 u1 \1 k" ^6 { /dev/hda1 488006 8239 454569 2% /home% p- G/ F. Q" M9 T
" t7 j9 M4 I# }0 f3 U6 s自动挂载:, p2 F+ Y9 |- |; ~: h- S" [) B
- vi /etc/fstab
2 \, a: v. ^' Y3 u- F; i( b6 n' `
0 M2 Y4 l8 v! J8 e/ H1 S8 a+ d- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0* r2 }1 J9 ?, S
- 4 Q e; x) Z V v4 U
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:( ~0 }0 e1 _5 Y5 s
- mount /dev/sdb5 /mnt/ljp1/ |3 s; i) U' S# C: Q! z n- J9 }
- 2 f! t- e# T7 F, p- d0 o* \8 @
- mount /dev/sdb6 /mnt/ljp2
复制代码 * i/ A* ]9 \" ~' m: A
7 `# _8 `) x7 w. k: a n; H1 l
* j5 n. y1 u# H1 T |
|