|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)( s2 @4 h3 a/ t
or: fdisk /dev/sdc (for the third SCSI disk)7 {" ^+ h" G- q. g2 Z9 o
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
$ V4 G% |3 S5 L2 x l or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)! T5 |$ m5 ?/ l7 R. [. Z& y% T, T
...1 }. r, b$ h5 X
- df -k" f' G) w( Z% ^. I9 {3 C
- df -lh" { u* }; k: z) w0 S
- 查看有几块硬盘:fdisk -l- ~( h5 J. o+ ]
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点1 J$ c" I9 R" `( @* J
/dev/sda3 3723848 705968 2828716 20% /
7 A1 w/ L3 j0 a: B5 G8 Q% J /dev/sda1 101089 9274 86596 10% /boot
) ~, }9 v2 j1 A! n: X2 _ none 14520 0 14520 0% /dev/shm* J! v+ z3 Z' f5 S. ?( A9 `
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用. r9 h N. `, u# V9 g
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel6 Z5 v$ }% O1 {& j" h
Building a new DOS disklabel. Changes will remain in memory only,
# K" k! ~9 ^$ I o9 S8 S5 X/ ] until you decide to write them. After that, of course, the previous4 ]( x* h6 y* {& y0 F4 W2 G
content won't be recoverable.0 P3 b; z: O8 q+ W# c1 ?8 n5 A2 R
The number of cylinders for this disk is set to 8322.
! P7 g- X0 N: F- n$ j$ Y3 u: N There is nothing wrong with that, but this is larger than 1024,. y' F% n! o+ p1 J( R8 _, M7 M
and could in certain setups cause problems with:
! l4 m. R6 U" {/ y- N0 z 1) software that runs at boot time (e.g., old versions of LILO)
, ]1 N4 k, L$ ^% n 2) booting and partitioning software from other OSs* D# ^2 V& L& _2 x( U
(e.g., DOS FDISK, OS/2 FDISK)
/ \1 Z) W4 Q. R6 D- L- `) ^ Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite), N$ L8 U) e; }1 {7 y5 R6 b9 k U& ?
Command (m for help): p3 H* }' Y1 L$ g# }( i' K
Disk /dev/hda: 4294 MB, 4294967296 bytes
0 g$ n3 Z; S8 e+ j Z3 I" {8 H 16 heads, 63 sectors/track, 8322 cylinders: M# X1 ?0 t% L% G8 @( q! Q% G
Units = cylinders of 1008 * 512 = 516096 bytes) v3 K: {6 a: |4 f; v
Device Boot Start End Blocks Id System% j3 S$ y# B# V7 e( W% ^7 X/ T) j L
Command (m for help): m# E; x3 q* H4 M* s5 a/ q% R
Command action
# c* a3 V; G/ y1 w2 } a toggle a bootable flag
6 Q& Y/ z3 n3 ~, ~6 [* r+ J5 O b edit bsd disklabel/ c9 d. O' v8 M% @) j: H5 o7 {! e
c toggle the dos compatibility flag6 V; k2 _2 l- v8 V. \; }$ h" k
d delete a partition
4 y, A, M& G( H+ N l list known partition types
$ o0 N# I2 P( I0 a m print this menu
; X6 f- c" i8 i( h( Y n add a new partition& x6 P6 C# Z. K: |
o create a new empty DOS partition table
8 R# v* S6 M, L$ u/ _3 x8 C$ ` p print the partition table- Q' M7 `, G; \/ E1 p2 O z g
q quit without saving changes$ m1 r- {+ x% G; z# t; }# s( d
s create a new empty Sun disklabel
; x+ }% w5 e1 W" m t change a partition's system id2 X% ~2 I& _5 E, X
u change display/entry units
# @5 W( l% \" f; J! Z5 D J+ z9 m v verify the partition table
P; R" _# C2 A/ M* C C8 @ w write table to disk and exit
. g7 q/ v5 D" V. l9 c/ \% r x extra functionality (experts only)
" L* U& j" {% T" N" C Command (m for help): n% E$ m) P! e5 M" s/ ?3 {% H0 Q' ~
Command action
1 o- Y+ ^) l: b; G4 U7 d e extended
3 d8 K+ c8 `# w p primary partition (1-4). e" D; X0 S+ C6 o9 U( ]& L3 O' T% S
p
7 B: d% ?+ |/ Q- l8 t i Partition number (1-4): 18 k' N/ q) |- P$ n' [: q* W* n7 B. ]/ q
First cylinder (1-8322, default 1):
% v. r4 U! M& `1 }0 K, ?0 c2 W9 ^$ N Using default value 1
/ ]& V7 t+ [0 h# W2 y Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G2 f# s; u; w- s7 W- C
Command (m for help): p
_- r- U' f1 Y; i5 ^: { Disk /dev/hda: 4294 MB, 4294967296 bytes7 _- C0 k; P8 n# z3 j
16 heads, 63 sectors/track, 8322 cylinders
) g6 T' [. X9 A/ @0 d Units = cylinders of 1008 * 512 = 516096 bytes
8 J L4 O# Q5 C Device Boot Start End Blocks Id System: i$ h- o/ |5 K, ^+ X, v% _7 A1 S
/dev/hda1 1 1000 503968+ 83 Linux, _0 b; g5 k L+ C1 ?
Command (m for help): w
* e! x9 C5 Z3 J7 _ The partition table has been altered!
# y8 b! [, S1 ^! e1 J3 z6 {7 A Calling ioctl() to re-read partition table.
$ \) `& W$ X' m& q: u- T# c Syncing disks.
7 e( H, x" u6 K4 ] //格式化新分区
7 l( k6 K7 Y/ M0 a- Gmke2fs 1.32 (09-Nov-2002)
0 A# ]) W7 t4 V1 D Filesystem label=# _- k# H' v6 k
OS type: Linux
+ L7 D, ~* [$ h9 T; A Block size=1024 (log=0)1 ?; E; x* e$ x8 }7 y' h3 s
Fragment size=1024 (log=0)
, B! t/ X% y! `! E$ C( c- b: r 126480 inodes, 503968 blocks. O. d( k. D! P
25198 blocks (5.00%) reserved for the super user: a* v2 F, C. ?. {1 w J# q
First data block=1
1 ?4 x! r8 A# ~/ n9 n# e; G+ C 62 block groups
' E* v2 J+ X* V+ r 8192 blocks per group, 8192 fragments per group
7 G: g x+ P" |+ P6 b- p 2040 inodes per group' ]7 \% e/ L( X$ \! e+ U6 z7 D
Superblock backups stored on blocks: ( f6 b: X- D- B9 x R2 j
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014098 q6 r" g% D) m# \3 N S/ S
Writing inode tables: done ! Z. w$ o! I% Z* j9 j" \
Creating journal (8192 blocks): done( o; }6 Z6 u* x# G7 I
Writing superblocks and filesystem accounting information: done
* u0 x3 Y' J( v9 l8 d# b This filesystem will be automatically checked every 30 mounts or, ]9 }+ w' L( _' S
180 days, whichever comes first. Use tune2fs -c or -i to override.
/ C4 T1 D0 ~/ m4 v6 F7 U文件系统 1K-块 已用 可用 已用% 挂载点
; }9 b) l' F) j( S! x A. { /dev/sda3 3723848 705992 2828692 20% /
: e Y- }; i$ m, e5 Y! ~3 T /dev/sda1 101089 9274 86596 10% /boot/ y% G) g8 T; A# J
none 14520 0 14520 0% /dev/shm
, f- y! x4 s% O; J. o //挂上新分区
0 D1 A# c3 r+ i; o2 p+ Q- mount /dev/hda1 /home+ p6 ~- u3 Z2 f/ m0 O* x$ v
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
) w. q% E# T& B5 K I) b /dev/sda3 3723848 705992 2828692 20% /) a7 ]% d1 F) k5 G& t% J
/dev/sda1 101089 9274 86596 10% /boot
& V, W: Q# E# M1 }% o- N) y none 14520 0 14520 0% /dev/shm
, d: q/ d( ?4 M: a& _ /dev/hda1 488006 8239 454569 2% /home
% e* a! Y' h4 R8 N% X9 X0 W0 f7 z9 N; _0 g
自动挂载:2 [4 ~& e. J6 j8 }& y
- vi /etc/fstab
9 Y2 g* ^( Y' Y% { - % E4 S- V- a" I# G
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
8 B- S: \: F2 M* Y
- E7 Z0 a7 f) @0 v- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
0 r! [. g9 K1 p6 q- mount /dev/sdb5 /mnt/ljp1" v; A: B0 y2 U
, ]% o/ @- k' h! O( g0 ]+ e" {* }- mount /dev/sdb6 /mnt/ljp2
复制代码
& Q- n/ \- h& h _7 Q6 T7 k
$ w, y, C5 V" b F5 ^& y$ u, U3 [7 L* d$ D2 V6 z& |9 S! m
|
|