|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
; k1 v1 v, {/ [ or: fdisk /dev/sdc (for the third SCSI disk)
& o0 q5 Q3 _/ G9 O or: fdisk /dev/eda (for the first PS/2 ESDI drive)
7 q! @4 ?% @1 S/ d8 `/ s or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)9 S m) V* y- [* c3 i4 ?
...
d5 |9 X! N8 L1 T- df -k
; @$ v/ @2 I- {: f j; S4 Z7 q- } - df -lh
. W y% H, ^2 q, l - 查看有几块硬盘:fdisk -l
1 B# u2 X: V, Z
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
5 k, G; E" @7 N8 v A3 ] /dev/sda3 3723848 705968 2828716 20% /
: h' O9 p. J+ `' M. b! q. z$ _ /dev/sda1 101089 9274 86596 10% /boot
9 O$ F1 ]' L$ m! E/ U7 I( t5 F none 14520 0 14520 0% /dev/shm
. @% t, E& i* E2 N 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
# R3 ]- Z) e8 I3 Z7 [0 @Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel3 z- O; {. Q6 W# e2 @
Building a new DOS disklabel. Changes will remain in memory only,* W- P! V4 ~' j/ C8 i. i
until you decide to write them. After that, of course, the previous& L3 D3 E1 H0 m! e( C
content won't be recoverable.
: \. J, V' Y% a) i The number of cylinders for this disk is set to 8322.
6 M$ |* V, P* V- ^. a- g8 d0 ] There is nothing wrong with that, but this is larger than 1024,& h- b! V! ] z" ~
and could in certain setups cause problems with:$ [- X* Y2 \* G# W2 S
1) software that runs at boot time (e.g., old versions of LILO)
6 [# Z" q+ V$ p% W% B% `5 j 2) booting and partitioning software from other OSs
0 O; V! m# H* s! \3 ?: g9 w (e.g., DOS FDISK, OS/2 FDISK)4 {) G' z" T2 i3 a7 I. p
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
' t) w9 K1 v& } Command (m for help): p
) u6 N# y. V/ j* V Disk /dev/hda: 4294 MB, 4294967296 bytes
9 w$ Y/ l" N4 c+ Z 16 heads, 63 sectors/track, 8322 cylinders
% o/ ]& v* \* r9 D! `! e9 L: b* m% I Units = cylinders of 1008 * 512 = 516096 bytes
% c# W* c# l- L, E3 S# u8 n Device Boot Start End Blocks Id System% F! `4 |/ Z% \/ _+ y
Command (m for help): m4 e5 @1 _; }6 s
Command action6 B. r" G0 `: U
a toggle a bootable flag0 e- x `- g! y+ f m
b edit bsd disklabel
* t7 }. q" K) o. q" k4 [7 X c toggle the dos compatibility flag2 a) {9 h6 n$ S& e9 o1 ~. a" P
d delete a partition3 E% x( c5 m! U* l. c! R7 t( j
l list known partition types
( T8 x! A3 m' J7 ~, k$ I0 I m print this menu
: L5 I4 @) ?0 N: G: T& Q' G n add a new partition+ b' G7 y. w8 m7 D. a$ K
o create a new empty DOS partition table( I) D( f! F0 N7 m3 K
p print the partition table" ]1 F7 v: a5 f1 Q
q quit without saving changes- c$ W2 ~1 m+ |: O; m- F( o
s create a new empty Sun disklabel
. R$ x1 v+ q0 n& |* z6 f t change a partition's system id. r% o0 Q- O$ y" L( q
u change display/entry units
$ p; C' p- ?* U v verify the partition table# M5 M7 r8 \5 j2 Y$ L
w write table to disk and exit
* z ~) O7 \* S7 l8 _9 \. D x extra functionality (experts only)2 S6 m5 T8 X' x
Command (m for help): n
& _/ X3 o9 X0 Q- U; i" d1 r Command action
7 f( E1 {% C$ k+ g) h e extended
# T; V* [& ]/ `. s/ X: m4 e p primary partition (1-4). \+ o' }( o, m
p: u, Y% s& b5 Q
Partition number (1-4): 13 P4 o1 Y! y3 F; \" }
First cylinder (1-8322, default 1): . k, C) p& n! T3 w( Q$ E
Using default value 1
( [- K$ O8 h/ L8 z0 Y: v8 p Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G$ ?( V, z& a, Z; K; G
Command (m for help): p
8 [. L: x3 b! D) S8 T Disk /dev/hda: 4294 MB, 4294967296 bytes1 Z4 F( i8 {, q
16 heads, 63 sectors/track, 8322 cylinders: G9 p' y/ x0 t q2 }
Units = cylinders of 1008 * 512 = 516096 bytes
, N3 x j1 S/ E Device Boot Start End Blocks Id System4 K5 h+ ?3 _) x
/dev/hda1 1 1000 503968+ 83 Linux4 H% j _$ ~4 l6 v1 V5 c
Command (m for help): w& w, d) x4 z% M6 n* b8 O
The partition table has been altered!7 k9 F ?+ E( f
Calling ioctl() to re-read partition table.
! i+ |9 r6 ~& W4 q' U B Syncing disks.
& X# M5 I0 B1 I7 _6 x3 M- ^, S9 l, p //格式化新分区& A2 {: h8 b6 T" E- E
mke2fs 1.32 (09-Nov-2002): G7 l2 T3 y0 H3 |" q4 d
Filesystem label=
/ j& D( j. _, Y0 ]5 n7 R4 Z3 _7 p' c OS type: Linux- `$ _" A4 A: A3 W
Block size=1024 (log=0)( w' I9 r# s; f- g$ n0 Q2 W
Fragment size=1024 (log=0)- N3 Z. c8 L! j/ N
126480 inodes, 503968 blocks
/ i4 p9 j" {1 W) A/ l3 ? 25198 blocks (5.00%) reserved for the super user
1 J+ z' H% s0 p% h4 l) ^' [$ |! Y First data block=11 `; d: \3 u9 i, |
62 block groups0 V$ N4 V8 h( m* K" O# `
8192 blocks per group, 8192 fragments per group6 Y3 R1 b0 V. i8 Q; o. L& ~+ M
2040 inodes per group" f4 Z" @! f5 I
Superblock backups stored on blocks:
, q) @4 i# C% G, Z4 g# J 8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014090 l0 j+ m" G- @- J5 Y4 g
Writing inode tables: done " L. W! ]* M5 ]' z
Creating journal (8192 blocks): done6 [7 X2 ^4 A3 r
Writing superblocks and filesystem accounting information: done9 v6 b$ ~, S$ K
This filesystem will be automatically checked every 30 mounts or4 W+ {8 B" _8 ~% f. o( g
180 days, whichever comes first. Use tune2fs -c or -i to override.6 Y# @& k! d) K! U1 j: }3 _6 h
文件系统 1K-块 已用 可用 已用% 挂载点
% w3 c2 e1 k& k; S; Y! O /dev/sda3 3723848 705992 2828692 20% /4 \. Z( v' |. E' p. d0 l( T3 M! G
/dev/sda1 101089 9274 86596 10% /boot
6 _" e4 B* w1 k( h" o, `3 S none 14520 0 14520 0% /dev/shm& v8 O5 L3 b3 ?3 J: g4 E2 R5 i) _
//挂上新分区
; y' k# |8 S: y+ B; B- mount /dev/hda1 /home
+ S8 M, W. |2 V" A# z2 `: ]# x' P - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点) h1 {$ Z3 x4 Z& W" o
/dev/sda3 3723848 705992 2828692 20% /; M+ W7 U) Z$ q) {
/dev/sda1 101089 9274 86596 10% /boot
/ C# j3 L) Z6 B& W, j none 14520 0 14520 0% /dev/shm
/ G6 i" |0 b& N0 g; }- X /dev/hda1 488006 8239 454569 2% /home
' B. Q& f* e) s+ O) K. q
% ~$ a! I$ N' O自动挂载:0 U8 \. q6 O, g9 @
- vi /etc/fstab
/ B+ E' Q( T! Z- b: {0 r
8 o7 H0 r& j' c- L. T- ~7 W- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
6 v4 C" \! d( Z/ J% r, p
' s( k! P. t0 Q, ~' k! L$ G- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:+ u/ c# K' x8 g9 @; e1 Y* G: |
- mount /dev/sdb5 /mnt/ljp1
' w( I2 I7 H" \0 j, S H. [ - 7 h a* o+ Y7 ]+ b
- mount /dev/sdb6 /mnt/ljp2
复制代码 * b( |, @$ i- u
8 ~& ?4 B0 c. V& v5 e
9 V& E1 P" p7 u
|
|