|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)5 n2 p `/ i3 z# R0 s+ L0 j
or: fdisk /dev/sdc (for the third SCSI disk)
9 P$ d* ^' }: b1 n& o, S or: fdisk /dev/eda (for the first PS/2 ESDI drive)
4 E" ]+ C( D n$ T or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)% P6 Z/ a; x7 Q7 E, C9 d! k
...2 _3 w8 m' g% d
- df -k
* C0 f, D- F! b B* b7 |- W( n - df -lh! |# ~2 T: d) q; d
- 查看有几块硬盘:fdisk -l
( W1 L8 U6 ^( ?1 z7 U* _% w2 Q
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
( y6 j( o- }; T /dev/sda3 3723848 705968 2828716 20% /# u% x5 L6 k x% |$ Z
/dev/sda1 101089 9274 86596 10% /boot6 p5 x4 d. i0 Q0 |# J2 |3 X# @
none 14520 0 14520 0% /dev/shm
' A4 H3 z Y! o; ?. E1 U, F 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用9 _' d( D! T& |& `( }
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel* j Q% w; W- i/ q5 d' T* |
Building a new DOS disklabel. Changes will remain in memory only,8 _0 N6 b2 l! o9 _$ z6 b
until you decide to write them. After that, of course, the previous
) W& F8 O' H. E6 I! w* ? content won't be recoverable.
' |/ Y" z: ~9 y! j" p9 f The number of cylinders for this disk is set to 8322.
6 H& t- T* z- z6 J- }. k6 e3 w There is nothing wrong with that, but this is larger than 1024,
7 j1 Y Y* K9 B and could in certain setups cause problems with:& A% u3 |( [: {
1) software that runs at boot time (e.g., old versions of LILO)7 b4 Z5 m% t) S8 p
2) booting and partitioning software from other OSs
9 ~1 U8 {6 B% v; A8 `; E2 Q% k, r (e.g., DOS FDISK, OS/2 FDISK)
: E+ W& X2 s% f3 X Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)! j4 \1 a5 y" n T2 Y) ~+ o
Command (m for help): p+ H; Y+ Z5 u9 _$ p. w9 t3 G3 K1 _$ J0 C
Disk /dev/hda: 4294 MB, 4294967296 bytes8 r) D/ n# h) K7 z/ f
16 heads, 63 sectors/track, 8322 cylinders) y6 u) {5 ^$ \. b
Units = cylinders of 1008 * 512 = 516096 bytes
. w/ M3 {7 h9 H: L" F% e7 M Device Boot Start End Blocks Id System, ]& w+ \( c1 e ?; }; E
Command (m for help): m
9 e8 _$ g- ^$ D$ Q Command action; ^1 F z9 W' ?3 s/ R
a toggle a bootable flag
+ a7 ^$ Z0 {- X5 Q' E4 @ b edit bsd disklabel+ M/ [' L) c* r1 b; }" @
c toggle the dos compatibility flag
, ?- Z) h2 Q6 C# h; n9 g d delete a partition
, T4 n" X( o! V1 u' L+ B l list known partition types3 y5 m- ~" v( H5 ^, g! F, B0 ?
m print this menu
% x* p( T6 W, \4 x3 l n add a new partition
" ~& [ \0 N" I: V' ~! j o create a new empty DOS partition table9 U) [& ~0 f9 C( k6 Z
p print the partition table0 T* Q& A' K. X- Z+ X$ M% C: E' _
q quit without saving changes9 D, r0 E8 I7 r
s create a new empty Sun disklabel; I. [9 A- R& v0 e; Y
t change a partition's system id3 R* J3 e1 ^! t8 {5 `
u change display/entry units
, S. U% j7 g) u0 q$ y& k v verify the partition table+ D4 n' H/ S. t; }5 }( [8 B+ G
w write table to disk and exit+ K: m' d: p8 B2 t. a
x extra functionality (experts only)$ G2 b$ N$ _% z
Command (m for help): n$ F! L& z/ _) S# c) k4 Z8 y$ v
Command action/ J: @4 ^- G# ~9 R4 Z9 F6 `' X. h
e extended. E$ d$ R. a) U P+ q
p primary partition (1-4)
* @$ V2 ^1 x0 X8 i p9 _6 _% K5 x8 G2 s% L% r/ e4 s2 C4 R
Partition number (1-4): 1
# G. ^; V5 z6 a6 H# l8 I; V2 p First cylinder (1-8322, default 1): 5 A/ s# T, _, b
Using default value 18 t+ d/ w: A N& b
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G* B0 f8 Z; K' s
Command (m for help): p; k! ?+ k. c7 ^1 ] w4 _
Disk /dev/hda: 4294 MB, 4294967296 bytes$ ]7 u, a- e1 n) u# h* E; A
16 heads, 63 sectors/track, 8322 cylinders
' I7 {$ e% C: z6 X Units = cylinders of 1008 * 512 = 516096 bytes
" k, b. S1 h0 v3 R+ o Device Boot Start End Blocks Id System0 T& R% Q/ ^( \; V/ t% ]
/dev/hda1 1 1000 503968+ 83 Linux
, X, {. h/ z. Z' G Command (m for help): w5 F! }( B7 z" z9 d5 a
The partition table has been altered!1 V! p) l' Z% \3 w4 u! {
Calling ioctl() to re-read partition table.8 E+ W( h8 K9 e( D/ ~4 g( X
Syncing disks.
4 t1 e, d& H1 P2 w9 ] //格式化新分区
/ b2 O7 _( a8 l' Qmke2fs 1.32 (09-Nov-2002)/ d N6 t* g% F
Filesystem label=) u( M# p8 a4 J, l
OS type: Linux
, K* {( u7 E3 x- @+ S+ o Block size=1024 (log=0)2 z1 X& ]$ B# f
Fragment size=1024 (log=0): e' l- r: V/ r# B8 I# t ]
126480 inodes, 503968 blocks# W6 K/ o9 ]' r8 {- _7 J3 o2 y
25198 blocks (5.00%) reserved for the super user
' @) x# W% |% d First data block=1# p; c3 A5 c) S' J( {
62 block groups g R; m: ]7 r* Z) i( ^$ \
8192 blocks per group, 8192 fragments per group
. ~- o, D4 v- _ 2040 inodes per group9 a5 H+ ]" j; B, Y0 Y
Superblock backups stored on blocks:
! y9 v8 q2 _( E3 c1 B# n 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
$ m2 f7 r+ q2 b' K! a% P! V7 ? Writing inode tables: done
: ?4 l+ n X# ] Creating journal (8192 blocks): done
* R' Z6 R1 s7 M5 E' E( v Writing superblocks and filesystem accounting information: done$ A$ d( O( U, W* I/ m; U X
This filesystem will be automatically checked every 30 mounts or0 c$ f! W# ^9 s; y& f6 S
180 days, whichever comes first. Use tune2fs -c or -i to override.
. X) R5 K7 F9 A9 R# a文件系统 1K-块 已用 可用 已用% 挂载点
; u5 s$ G( F1 `; b) V /dev/sda3 3723848 705992 2828692 20% /9 ~6 ?( A' E* N: J& q
/dev/sda1 101089 9274 86596 10% /boot
" S# M; d1 a+ u& o: N I1 \ none 14520 0 14520 0% /dev/shm
. K$ o. }$ T+ D9 D7 x //挂上新分区
7 m# x) t' [+ B4 a$ _- k3 x+ W- mount /dev/hda1 /home
% i& y+ s( V/ Q. L( W - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点- j; u6 W! Z! ^4 L0 x E
/dev/sda3 3723848 705992 2828692 20% /
" _" m1 S/ z- ^5 X% F /dev/sda1 101089 9274 86596 10% /boot/ m% m' j! A' ^) |! K; y
none 14520 0 14520 0% /dev/shm
" ~6 w0 i* _/ ? /dev/hda1 488006 8239 454569 2% /home
3 h6 ^( n/ }# h* x1 m t: T& c; Y+ j
" T+ K3 h: _7 a- N& m自动挂载:" t4 c5 b% y: j! }
- vi /etc/fstab/ e" |- M6 k/ ^" g2 n
! ]: I. o8 G; g! c# A- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
; `! E$ O3 x) z' o6 c' P7 f' A
% D6 ]6 h+ X( d/ u- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:; F! M/ k2 x0 k
- mount /dev/sdb5 /mnt/ljp1
+ d1 D% h' [' n, g2 @
! y) c% ]* c$ S+ c- mount /dev/sdb6 /mnt/ljp2
复制代码
4 N1 ~+ P& T2 f/ J- ]$ I6 q! v. b6 J; D6 ~
! ? D# a+ l8 o
|
|