|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)3 q h5 Q( b4 |" U+ N8 @
or: fdisk /dev/sdc (for the third SCSI disk)
% d4 F% G! o8 z/ C5 m7 e; _: w or: fdisk /dev/eda (for the first PS/2 ESDI drive)
" @- t6 u5 J) o$ ~0 k; U- `$ F or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
|. A! h7 I. G ...$ l2 E7 j8 O$ ~
- df -k
- q0 X4 P0 T1 t3 t8 F0 I [ - df -lh: O! ]7 D8 R! B1 G: d" @! ]
- 查看有几块硬盘:fdisk -l
9 m; Q4 x6 Z/ K, U9 F A3 A
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点0 q) ~* j# {9 I* Z
/dev/sda3 3723848 705968 2828716 20% /
1 U8 ]3 \ b" S3 F7 z /dev/sda1 101089 9274 86596 10% /boot" S& F& [7 J* n0 H3 w
none 14520 0 14520 0% /dev/shm
- u( p7 h& l( @8 A; a: J7 A8 { 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用, ~8 }* \7 O) d2 X
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel' g8 `, D. k9 P1 u8 l# o7 j
Building a new DOS disklabel. Changes will remain in memory only,
/ R6 B* K3 P* M+ M+ K until you decide to write them. After that, of course, the previous
$ q" O; F8 f" Z content won't be recoverable.
h- W6 x# c: P! D( | The number of cylinders for this disk is set to 8322.
# F2 k8 G$ |% R% E0 k There is nothing wrong with that, but this is larger than 1024,
: V$ G( j5 Y2 N; e) ~" ^% R6 u and could in certain setups cause problems with: P' v, Q1 ?6 w) |+ b
1) software that runs at boot time (e.g., old versions of LILO)
% B9 \* P+ s g4 e' T4 O# g 2) booting and partitioning software from other OSs' d! d3 ]$ N! F$ e( s5 ^
(e.g., DOS FDISK, OS/2 FDISK)
' Z/ |: @3 ]" b) ~: T Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
6 v, ]2 H' ^1 O/ p Command (m for help): p
[( E1 M, N3 P Disk /dev/hda: 4294 MB, 4294967296 bytes
* j* ?5 B8 ]2 X4 w; z 16 heads, 63 sectors/track, 8322 cylinders
' Q) m3 H2 U" C2 Y' r Units = cylinders of 1008 * 512 = 516096 bytes k1 ]0 b( H* E/ q% _2 v6 }4 ]0 O
Device Boot Start End Blocks Id System
8 I6 |& w" q* E& u Command (m for help): m5 q* B2 | n0 V7 Y q
Command action
. C6 ?8 \* r% x a toggle a bootable flag0 G* T9 ]" v% p5 y( {) x2 @+ o8 i: d
b edit bsd disklabel3 s: ]; c( p* B7 }3 X1 e! }# @
c toggle the dos compatibility flag
0 G' f1 z/ F4 m( A) [ d delete a partition: N& ]9 Q+ N" q, k1 d7 E4 J! S
l list known partition types" ^/ W- T& R+ N; P+ J; {6 \
m print this menu
! g1 y) `4 {# C) E8 f n add a new partition
2 b$ _6 N t; |: \# F- j# _ o create a new empty DOS partition table; t+ |: w& }7 ]6 d) ]4 d# { ]- {
p print the partition table
0 C6 C: `) U8 U+ `' e5 f q quit without saving changes
( A! `# E7 ]0 ]% [ s create a new empty Sun disklabel
5 w6 b: k0 u6 B X" o7 i5 F t change a partition's system id
! x8 ?& W% j: _1 I u change display/entry units6 {$ Z+ a- o) H# e$ i+ M
v verify the partition table
+ r) U D7 j4 @ w write table to disk and exit
& M3 k/ u! b% d0 V: i( S x extra functionality (experts only)
& m% P5 C5 @% c9 U Command (m for help): n0 t. `/ ?! ?, f# O1 G4 U2 H
Command action, d$ L, a/ L2 A. Z, G
e extended
$ G0 h8 q: v8 ~8 ^ q- M& Y p primary partition (1-4)
. x4 u6 Q1 g3 V% _8 z p# b" v1 X2 o' _* C
Partition number (1-4): 1' ^9 G4 B$ k% o
First cylinder (1-8322, default 1):
( E6 `2 [$ U7 d, |( a( a' w7 {3 ? Using default value 1
2 M, V9 |" \+ d6 o9 l Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G O- B* Z- Q; I' l! ]' Q
Command (m for help): p
1 \, X5 e0 z9 O% c. t5 W# E4 x9 W Disk /dev/hda: 4294 MB, 4294967296 bytes+ M% ]& x3 v9 X' N* \1 `0 d' q$ I
16 heads, 63 sectors/track, 8322 cylinders
& ]8 L) }; o/ _- m Units = cylinders of 1008 * 512 = 516096 bytes
% J/ O" `; |5 k6 ` Device Boot Start End Blocks Id System0 @* r: Q3 _* A) |1 L% K% X
/dev/hda1 1 1000 503968+ 83 Linux4 }+ V) ^; f% b" I# _1 I
Command (m for help): w, t. S# {6 d1 d* T6 e+ r6 A
The partition table has been altered!# q3 r; l1 o( k
Calling ioctl() to re-read partition table.
% { f7 n8 |7 ~0 Y4 Y$ q6 t Syncing disks.
) y. }/ I0 D, \0 O //格式化新分区
: S6 E1 P' \ rmke2fs 1.32 (09-Nov-2002) \- Z% a* l" @) e
Filesystem label=+ [. S% E8 N% J6 q0 p; Z) ]! \
OS type: Linux
" y( b& B: I# ^) m3 o) G( { Block size=1024 (log=0)
, N. k: X/ h# ~- g$ H m# g4 R Fragment size=1024 (log=0)# N* i0 [9 {. c: D( j( x
126480 inodes, 503968 blocks
; e( ?9 D! Q4 Q6 d4 `- _, _ 25198 blocks (5.00%) reserved for the super user
" G, p7 k8 X) x! u. [5 D/ x First data block=1
! d+ y( M& G( ^' i8 ]& j( ~) k 62 block groups
- a- E* ~9 Q8 V; k) M* r3 O8 s 8192 blocks per group, 8192 fragments per group
& [: G0 b" g0 C' j/ M 2040 inodes per group
4 G! L# B8 E r9 A$ p Superblock backups stored on blocks:
7 O. t8 m/ }. j0 i' T2 j z2 N1 ] 8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014092 k1 w5 Q" p; Z
Writing inode tables: done
2 o# t; c9 [; _) S3 G' K Creating journal (8192 blocks): done
1 ^2 M. P5 ] R3 P Writing superblocks and filesystem accounting information: done
+ k R( B* f/ _: [ [2 x This filesystem will be automatically checked every 30 mounts or
# f6 X- x- c" N; G+ M" }2 P$ U L' J% n 180 days, whichever comes first. Use tune2fs -c or -i to override.
, U" r8 Q$ g0 z9 Z8 c文件系统 1K-块 已用 可用 已用% 挂载点& `7 _% q! v" @: ^: H
/dev/sda3 3723848 705992 2828692 20% /0 o% |# C$ D9 p$ Y
/dev/sda1 101089 9274 86596 10% /boot- B f) S) r2 g( @: ~% r
none 14520 0 14520 0% /dev/shm# Q& v$ B- a5 {# Z0 t
//挂上新分区
7 ?! g! W( {) D! t; y$ `7 i1 u- u- mount /dev/hda1 /home4 [" c+ S1 q3 c$ f5 R
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
' @' o# Z/ i8 v- c' y+ P3 U) u* c /dev/sda3 3723848 705992 2828692 20% /1 [# }, I: P9 w1 y
/dev/sda1 101089 9274 86596 10% /boot6 U( a: X9 y5 x! A; X
none 14520 0 14520 0% /dev/shm
8 a$ M, F9 _* G+ w: B /dev/hda1 488006 8239 454569 2% /home
0 W+ q7 S* B/ t; D6 F7 I5 g0 r, ?# j7 g# W+ N6 [/ K
自动挂载:
: q" X0 {0 V! P" B- vi /etc/fstab
) T& h5 ]& }& K2 o6 ? - / H. p' ^+ y8 s3 M+ H
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
- v$ t$ T. s* O( w% ?
8 I. G! W% q, ?9 h- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
N: {# C# s$ P6 I) Q3 K% d- mount /dev/sdb5 /mnt/ljp1
% H) ^+ O" s1 {# H/ q2 m0 M
( O7 q, [4 |7 J+ Q4 n/ E- mount /dev/sdb6 /mnt/ljp2
复制代码
% J: }$ w7 v0 |; K0 I3 C; l
% k) y B: v2 U
, O/ P2 G# N" @* U9 I' G |
|