|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)( O, P) O' y9 t: J1 D' T% X! J
or: fdisk /dev/sdc (for the third SCSI disk)$ P7 @! S1 _( a4 Q8 I X
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
- H" U/ W, z' e( J) r or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
- V' S; M: q2 r8 ]$ { ...
5 W; N( }* v2 y, X; k% K/ m4 K5 [- df -k/ P, q0 b0 g: @5 T2 I1 \% B
- df -lh
0 d' S' B2 B: u - 查看有几块硬盘:fdisk -l
$ h1 b0 W) l8 V+ c
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
4 x: D* y6 x; {* j! k1 z% P /dev/sda3 3723848 705968 2828716 20% /
+ {& \. m( F( {5 I /dev/sda1 101089 9274 86596 10% /boot
% C/ h5 S; S, z! C2 G; ?$ C+ k+ | none 14520 0 14520 0% /dev/shm
7 x3 }6 b4 v5 d$ h8 D6 ]) K1 l 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
6 t1 u) R! V) ADevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
. I& F" H; L- c! k- x Building a new DOS disklabel. Changes will remain in memory only,1 H8 U% Y( ^8 K3 I( ~! G1 j7 a0 B
until you decide to write them. After that, of course, the previous
! K: Z4 a7 n1 a content won't be recoverable.1 P0 `6 l8 B. J' h
The number of cylinders for this disk is set to 8322.
( [9 ~! p) j$ V, [" [ There is nothing wrong with that, but this is larger than 1024,
+ o2 u$ A* g4 V2 R* d and could in certain setups cause problems with:7 g( Q& E$ W( A4 y/ |
1) software that runs at boot time (e.g., old versions of LILO). z" K. c7 x0 e9 D# l, N
2) booting and partitioning software from other OSs, c8 f+ Y- a+ k6 w- ?8 H3 k
(e.g., DOS FDISK, OS/2 FDISK)
5 K4 K3 ?% A3 m# X: U3 p- S. e Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)2 L5 q* [1 ]/ H8 O4 ] ^. y
Command (m for help): p
( g: T2 d' x0 c' S" v, p: ^ Disk /dev/hda: 4294 MB, 4294967296 bytes' P6 }7 H+ s9 M( o# N9 _( O" v( @ q
16 heads, 63 sectors/track, 8322 cylinders( n/ L) W2 N) `/ j8 \/ u; r
Units = cylinders of 1008 * 512 = 516096 bytes
) Q, H. t& Z* S0 L Device Boot Start End Blocks Id System
" x; \- ^: N7 }6 c- T& L Command (m for help): m
$ {+ b- }3 c# ]" p Command action5 Z/ L6 D; i t5 }5 d" _7 z
a toggle a bootable flag9 t7 A; h% R: U% Q9 x
b edit bsd disklabel
9 G% O% [- U6 ]# s( j( r7 q c toggle the dos compatibility flag8 e1 o2 N, ?. v+ V9 i. q
d delete a partition( p% T% K. w/ V: s# ^) I
l list known partition types( j6 U! P: J/ J9 E5 m. ?7 C3 o
m print this menu
: i7 l# t9 o+ Y3 ^9 ] n add a new partition. h, C w0 s4 S5 D' w
o create a new empty DOS partition table. A( Y! x/ ^0 ~5 k/ c. K
p print the partition table
2 R( m9 D1 T) F7 r" X q quit without saving changes
5 h. t! ^8 _# \4 s$ W( ~& l c5 u s create a new empty Sun disklabel! R' g! a5 M* j6 k8 L8 O
t change a partition's system id& |3 m! X! t/ ]4 I' y" X9 _ i
u change display/entry units
: b! \0 |0 C. u' Z) { P; P v verify the partition table
+ w0 S8 j. `9 M0 S+ Q% M# l w write table to disk and exit
3 s7 G+ v# C& Z1 | o x extra functionality (experts only)
9 s3 G+ P$ r' a2 K/ R" m" ? Command (m for help): n2 j% f6 [5 M! L9 [
Command action9 R. Z7 \- d) L* k: O: \- H
e extended
6 | a [# p& ]+ h9 D) D% c7 G) G p primary partition (1-4)3 U, w- g! h; c! Q2 f
p
/ n5 V* E" G) ]( C Partition number (1-4): 1
8 R b0 N0 N! S' H First cylinder (1-8322, default 1):
0 D6 E; c3 {. P) G3 t Using default value 1( K7 E8 f8 L4 F, q$ L2 o2 f) w( z
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
. u' R* P+ l' C5 A Command (m for help): p9 n6 U9 {9 d, R
Disk /dev/hda: 4294 MB, 4294967296 bytes6 C0 S \' c- |( p/ j# Q, y
16 heads, 63 sectors/track, 8322 cylinders; `& q# b: O& N0 j8 N- _
Units = cylinders of 1008 * 512 = 516096 bytes+ S4 ~* } n2 F! C3 A6 X$ E; Y
Device Boot Start End Blocks Id System& D: N1 I1 p2 _7 r2 ?8 N$ @
/dev/hda1 1 1000 503968+ 83 Linux6 u% H6 Y/ d6 o2 X/ m
Command (m for help): w
+ a$ V( f: f. E( a5 v The partition table has been altered!
1 ^$ g" t. u* r8 I1 ]& h3 m- W6 Q5 E Calling ioctl() to re-read partition table.3 L9 X- r/ @( K4 V- ]* }2 V
Syncing disks.
' K& i' S h5 J/ h W! w //格式化新分区
5 U# U4 j% b8 I! Hmke2fs 1.32 (09-Nov-2002)" W2 u9 c) {. o9 Z' L
Filesystem label=% d; z" S" I7 r" P6 ]& o
OS type: Linux3 u6 |* p/ C& D0 j# o7 u
Block size=1024 (log=0)
$ ^1 G: u! I' `( H: K) g9 P Fragment size=1024 (log=0)9 W1 q9 @& X8 g9 @1 s# {4 G
126480 inodes, 503968 blocks, p+ `1 z, a& T5 P! L. y' q! k8 z& O
25198 blocks (5.00%) reserved for the super user
4 C$ I5 g$ e; f First data block=17 a$ T9 A$ W# u. r6 j
62 block groups* @: r% c! r, n+ e
8192 blocks per group, 8192 fragments per group# V' O9 }2 J5 `! m' r; K) Q" ?
2040 inodes per group) i" f& W5 `+ p
Superblock backups stored on blocks: 5 [% V) K5 n9 O
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014094 S) j9 H9 Z! V+ O
Writing inode tables: done
( v* I0 B" e; }' o Creating journal (8192 blocks): done
+ ?+ r. s; I- y6 C# u" G: C V7 l Writing superblocks and filesystem accounting information: done9 }. y9 |: f& W' C. h3 Q3 J
This filesystem will be automatically checked every 30 mounts or8 H8 \' P' L2 n+ F- @
180 days, whichever comes first. Use tune2fs -c or -i to override.
/ q0 ]5 g4 k. Q( J Z; X文件系统 1K-块 已用 可用 已用% 挂载点
9 h+ Y3 f! n+ N* O' A% Q$ h /dev/sda3 3723848 705992 2828692 20% /- S+ U+ Q, `! B" s5 \# r
/dev/sda1 101089 9274 86596 10% /boot# Y2 a! h, n8 W
none 14520 0 14520 0% /dev/shm
0 l$ G0 L" t2 Z6 T! J //挂上新分区
: S/ G8 ^, a0 p9 R, s, A7 N' G' t7 p- mount /dev/hda1 /home2 ^ K& s2 v' Z8 W$ _
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
5 m; U0 P, ^: b1 {4 F% x8 A! C /dev/sda3 3723848 705992 2828692 20% /
9 {# U7 J+ p& `3 E! p /dev/sda1 101089 9274 86596 10% /boot
; u" a# x: d; d6 a, M( ~; `/ B! X none 14520 0 14520 0% /dev/shm( O! w E3 p' D
/dev/hda1 488006 8239 454569 2% /home' ?. Z& Z9 C0 k, B6 [
; J3 z, P- A+ @! I- M) a# Z自动挂载:# i( S2 y3 T4 Y8 K: h0 K
- vi /etc/fstab1 c/ G& E4 r* N w% T4 I
- k& Q$ C$ D b( r, G ^' F
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 02 i: v c5 c$ c5 k* L9 J# \$ |5 K
- $ } Q( s! t8 T
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载: }7 S7 z1 ^& p9 ?
- mount /dev/sdb5 /mnt/ljp1- F n8 B6 I3 c; D, ^$ n
* h6 p, r0 W5 p k5 n- mount /dev/sdb6 /mnt/ljp2
复制代码
0 f: X4 h6 S' z6 y4 ]% c& [ X2 i9 c* D" M
+ l( M. ^. `# u' [& k7 Y# X |
|