|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
' y2 z: V0 u5 v- U1 D8 N or: fdisk /dev/sdc (for the third SCSI disk)* P% J( G7 x. A% k3 s* Z
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
* \4 Q, B4 u; }) n2 e( c7 r2 T or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
9 e% J1 F7 I8 k( O( [ ...
8 P* I( U @3 ^6 |, _% l3 `7 |- df -k- P5 s1 \6 q8 c5 B n5 T
- df -lh* o! [0 W9 r# t" u9 ?0 c a# x
- 查看有几块硬盘:fdisk -l8 X) X! L; Q& B1 ~: g a3 i* [
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
$ @; ^- z1 a0 P c$ A& K/ m0 u /dev/sda3 3723848 705968 2828716 20% /
5 p& E, V/ R6 G7 w/ v6 C /dev/sda1 101089 9274 86596 10% /boot
) T" V3 a' P+ s5 ]0 J+ C* H$ l none 14520 0 14520 0% /dev/shm
) z8 X8 c) r* C8 L8 u5 m 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用! h9 X8 g% _$ x% S) ?
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel* x0 m4 N1 J# m; k! I* I
Building a new DOS disklabel. Changes will remain in memory only,6 ~- Q+ p. q& D& G1 r) }
until you decide to write them. After that, of course, the previous
& o5 O2 f3 w& u6 K content won't be recoverable.
* k6 i) n7 I0 ~; f/ S& l, C4 ]6 ^ The number of cylinders for this disk is set to 8322.
9 N. Z) R- b( T4 l3 j There is nothing wrong with that, but this is larger than 1024,
! H! f5 B# V: p7 k8 ?, R6 O( i and could in certain setups cause problems with:
) h5 r+ s) C; J9 o7 e9 ]( \ 1) software that runs at boot time (e.g., old versions of LILO)
# \4 \9 g5 a& f3 @' Z: ?6 p. { 2) booting and partitioning software from other OSs4 ~# l; O8 i4 N; G/ K/ a3 [/ U) Y- k( \
(e.g., DOS FDISK, OS/2 FDISK), c9 q" i$ b/ P- p! D: i( R4 C( a
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
3 Q: P# h+ @4 X9 K Command (m for help): p
* R2 T. _5 [ }$ M Disk /dev/hda: 4294 MB, 4294967296 bytes
% B5 u }; `9 u8 I6 a 16 heads, 63 sectors/track, 8322 cylinders$ S V$ |, I% V6 _
Units = cylinders of 1008 * 512 = 516096 bytes; v* ^- {' a$ w$ I6 l# q2 G' ]
Device Boot Start End Blocks Id System7 }/ m, m# |* ^* Z; x& [4 ?4 `
Command (m for help): m
4 H" Q5 |- ?7 }5 z7 U4 T* N1 @1 U Command action/ c$ K: G; `4 {' X5 ]! k) M
a toggle a bootable flag
" q/ y; d& `! t% S J4 ], U. R b edit bsd disklabel: [# v/ M {+ I* A2 z+ b
c toggle the dos compatibility flag/ ]3 j/ m: C R5 s6 f' s
d delete a partition9 J# ?5 v) E1 [4 m" p9 ~
l list known partition types' M! A: \ P( f% g/ B
m print this menu
0 s H$ x5 l* e4 D" D6 V7 o& f n add a new partition5 ]! \! Y: r- D7 w
o create a new empty DOS partition table
0 c4 `3 E( H6 i+ l, i; o& C" \ p print the partition table% l+ e' D+ B1 H( h" k1 l
q quit without saving changes
O& x; e8 g9 Q s create a new empty Sun disklabel
, P+ n( c$ J; y( c8 c8 R t change a partition's system id" f& `( H- ]% w7 J3 x
u change display/entry units' ]* g( M+ g% D2 C
v verify the partition table
; k; Q4 t: K( ~5 I6 J w write table to disk and exit
* }% t+ Q) y) v3 { x extra functionality (experts only)
+ `6 |3 y: k5 k3 ~' }+ A$ K, c Command (m for help): n; X, A2 H9 Q$ Q- z6 s6 m5 t
Command action
3 N% j; W/ A' V9 e0 O) r e extended
y9 C! N' v8 U) i' h; C# ?0 u p primary partition (1-4)
* q- T! s7 w+ v3 g' G p
( \. Y/ y$ ~" ?! c8 l Partition number (1-4): 11 b. d2 ]! J" R3 _5 M9 o# D
First cylinder (1-8322, default 1):
* x3 s, @4 K" ^2 `1 w( {- W5 N$ F Using default value 1
& ?; j3 b' z: s& ~ Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
$ P- \; K! A4 M7 X$ [ Command (m for help): p
" ^. s- } n- q% W `# E0 j% X& N* R* \7 V Disk /dev/hda: 4294 MB, 4294967296 bytes7 n7 P* t5 }. n, m! H2 J, c
16 heads, 63 sectors/track, 8322 cylinders) f; ~# ?% y l/ N8 J; o
Units = cylinders of 1008 * 512 = 516096 bytes
3 E4 d, Q! F, Q7 t- o! O' Q9 d" g Device Boot Start End Blocks Id System
F: }7 y, l1 R' R D /dev/hda1 1 1000 503968+ 83 Linux/ t1 O- N m0 ~9 |, l
Command (m for help): w
0 i5 ?# a* i) h The partition table has been altered!+ L4 \* W7 Z: u) V3 i
Calling ioctl() to re-read partition table.
& i8 `8 _8 c+ L) D2 m Syncing disks.
3 ^ J: e( A+ D3 I //格式化新分区( v7 m1 H% k: l1 ]. Q1 s- _
mke2fs 1.32 (09-Nov-2002)
/ t3 x! O5 z' S4 h# a+ c Filesystem label=
4 i; E+ o, C Y+ g; v/ h' t OS type: Linux
/ U2 G8 t! [/ r& t8 g Block size=1024 (log=0). Y1 h# C( B! `9 {8 G
Fragment size=1024 (log=0)$ _( ]0 O; S+ V3 ^8 G: f) W
126480 inodes, 503968 blocks- _; G( B# y1 X! _
25198 blocks (5.00%) reserved for the super user' v: M' Z# H/ K$ _; p; p
First data block=1
$ E; X1 j( ^& |* W t2 d 62 block groups8 R% z0 A8 ^. j* _. j
8192 blocks per group, 8192 fragments per group
; N+ z& C( e- P' |" { 2040 inodes per group
. x. }$ ?) }( b; y Superblock backups stored on blocks:
/ M! S9 Q y5 s' l4 [: l$ c& D& u 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409! F- y; R$ P' @! D* z& T% ^
Writing inode tables: done 4 X1 d# F% h7 B/ a
Creating journal (8192 blocks): done% A" m) h3 e2 {4 z" b3 A- z5 E
Writing superblocks and filesystem accounting information: done
0 G' b( H) u/ D# c This filesystem will be automatically checked every 30 mounts or
* r# C& r- U$ Z6 z 180 days, whichever comes first. Use tune2fs -c or -i to override.% m4 M7 N/ X" q$ y, w0 `* v
文件系统 1K-块 已用 可用 已用% 挂载点% R$ q! S+ E7 ^/ k8 K
/dev/sda3 3723848 705992 2828692 20% / S- i. Y, `- G' ^( W
/dev/sda1 101089 9274 86596 10% /boot
9 c$ ~, k; d" u; ^( p2 x none 14520 0 14520 0% /dev/shm
+ u' @8 Q. v9 B& s$ e! d //挂上新分区
3 d$ h2 Z3 u4 |5 p" O( Y5 d8 h0 l- mount /dev/hda1 /home
( A! R7 _' R; U- d1 A& ] - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点! c" i6 B) j0 Z( G
/dev/sda3 3723848 705992 2828692 20% /, W" {/ O; n5 |9 I( }
/dev/sda1 101089 9274 86596 10% /boot7 S- ]- C: o$ A' t( s( t
none 14520 0 14520 0% /dev/shm
, u4 h1 T! _7 t: n- e* r$ ^ /dev/hda1 488006 8239 454569 2% /home( D! {% H: T# ]# Q" {
0 ~# b2 w4 C* P自动挂载:2 n1 D! [- F5 D7 h0 t6 P. {
- vi /etc/fstab" A& y' ^/ Y) O5 U1 B7 j
0 L- o( O2 i' ?' b, `. ]- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
' b4 I7 [9 N' L2 b6 p7 f - 3 H7 B( d Z, E0 F+ x2 ]. b. I+ r
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:: s# `1 ]7 @- \3 x3 x% a# Z" F
- mount /dev/sdb5 /mnt/ljp1
( e' d o; K' }. K - ( k5 o( z/ W/ F- p" {' N8 v! t2 g
- mount /dev/sdb6 /mnt/ljp2
复制代码
2 ^ D$ W. P1 l3 I; Z$ Y4 a ?! t. S
' G2 w# q5 Q/ L
|
|