|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)5 D) e" }: }( T3 x, [8 p) B* B
or: fdisk /dev/sdc (for the third SCSI disk)
0 z0 Z5 [+ o! D' ` or: fdisk /dev/eda (for the first PS/2 ESDI drive)) W/ J7 B) m6 E2 F1 C
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
/ r5 x$ I" I- h( k0 H& D+ g ...
6 x6 R: r% |* u f7 v* f& b- df -k
1 a; u2 Y0 r# T9 H - df -lh
% c* ]8 j& H& u. Y - 查看有几块硬盘:fdisk -l
/ r1 Q0 Z0 J0 N( N @8 ]
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点- C% M5 Q2 i( H3 h+ @2 f0 C# C0 [
/dev/sda3 3723848 705968 2828716 20% /+ c% `8 Z3 r- T& x- R1 J
/dev/sda1 101089 9274 86596 10% /boot
a* j" `& C; x% B none 14520 0 14520 0% /dev/shm( C6 l, t( t: U& A8 U8 W; d7 c
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用6 ~. S9 L8 d. x! L, d
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel# @; F; b+ R3 r1 M' d8 B
Building a new DOS disklabel. Changes will remain in memory only,
]& I6 x8 H, ^ x: o5 N' j" A! Y6 ~ until you decide to write them. After that, of course, the previous
3 z: l5 B5 m) r; @; L* N content won't be recoverable.
( v4 w7 O6 n2 ?) ~8 n8 M The number of cylinders for this disk is set to 8322.
3 `8 n8 |5 s2 q+ r |- W/ V4 L$ H- y There is nothing wrong with that, but this is larger than 1024,! ~. {: t1 }6 }2 H
and could in certain setups cause problems with:2 f* d8 B1 _/ y3 O+ l! R
1) software that runs at boot time (e.g., old versions of LILO): g N* |) `0 g7 L5 H5 Q5 f
2) booting and partitioning software from other OSs
# v. s0 _0 m. u- f2 ^( N (e.g., DOS FDISK, OS/2 FDISK)
5 ?0 P3 l9 U5 x, E+ p/ ?: g Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)( R$ E- i, U" `
Command (m for help): p8 p! Z. e O& Y4 _6 y( D$ ^
Disk /dev/hda: 4294 MB, 4294967296 bytes; k2 _" n: G! q6 ?7 z3 N0 L& b# j
16 heads, 63 sectors/track, 8322 cylinders
# Y4 g' {" x' d, \ Units = cylinders of 1008 * 512 = 516096 bytes
. b2 t, X( a3 R Device Boot Start End Blocks Id System' ?. B2 H: E0 L
Command (m for help): m( j! ~5 p' O( `' K1 A" c
Command action
& G+ h, ^- w0 b. W* ~ a toggle a bootable flag, X4 Q8 F$ p1 [- }0 S$ _
b edit bsd disklabel5 R# E9 j" v8 {" ^& c! a0 a
c toggle the dos compatibility flag
) V8 ]; a6 d2 Y, ?/ j# b% P | d delete a partition6 ^& t$ u8 Z' h( i! S6 x* B: G
l list known partition types
9 V o! g( _( x7 ~0 W+ p m print this menu4 E% z6 o& ^/ t0 K; Y, @& _8 B& ?
n add a new partition' T" k3 m* s/ |$ @" v( i' Y
o create a new empty DOS partition table) U6 Z0 c( Y) J* S% O- N! w( B
p print the partition table5 P( Q J+ j2 v3 x# f% a: y
q quit without saving changes( o. F& \1 i( Z
s create a new empty Sun disklabel
" Z/ x0 H! o0 ~3 I- T- `! I# s5 V t change a partition's system id
" G5 E5 ]$ k, c" B$ s" W# r u change display/entry units
, g2 f8 o; J1 m: r$ N# z( I4 d v verify the partition table8 h, i$ H8 J* F+ c3 ^! d
w write table to disk and exit
$ y8 t; q8 U& K- t$ x9 `2 H+ w! D x extra functionality (experts only)* j( H) m# n7 u( S& T0 [% [. @" ^; @
Command (m for help): n
; F2 T) F* G" a( Q d, j" N" y Command action
- w* P8 O6 x/ c, {) A e extended
) l3 ^. D& U; P9 t2 K p primary partition (1-4)
8 Z4 C1 o2 M4 s2 W( f1 @9 g p' t! Q2 }: X; j3 ]! J/ C: E! e/ W* S
Partition number (1-4): 1
/ q' G+ c" {6 o r$ _1 k) ]& F First cylinder (1-8322, default 1):
$ J5 P: ?5 G0 `3 U) x8 w6 ?% y' m& ? Using default value 16 X' F: \, P1 E5 m
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G$ R+ x0 _$ t& D9 w% C0 T2 P
Command (m for help): p7 ~; Y# }/ Y, w& p* l% Y5 j
Disk /dev/hda: 4294 MB, 4294967296 bytes; g8 x/ o" d# P- f( o& V; J3 S
16 heads, 63 sectors/track, 8322 cylinders, r: t' q6 V# c: y
Units = cylinders of 1008 * 512 = 516096 bytes
; e' A/ n% c+ w8 ] Device Boot Start End Blocks Id System3 G# \5 n; j+ v4 u
/dev/hda1 1 1000 503968+ 83 Linux
3 _( \. S9 o# N+ b; v Command (m for help): w
9 Q1 i9 @% D$ r8 k The partition table has been altered!; G/ M3 ]3 }$ r# t2 y* C
Calling ioctl() to re-read partition table.. m7 z" ?2 l! R
Syncing disks.5 l/ j6 u% M9 R- M: X/ ]
//格式化新分区 ~3 a+ a- W0 Q% ~! F
mke2fs 1.32 (09-Nov-2002)0 p; Q) \) l0 J. W* W$ o2 i
Filesystem label=$ K7 t9 N: y# c: t& ~4 U
OS type: Linux
* j' N7 C- C: d" t6 `6 e Block size=1024 (log=0): o6 m$ p. B# _3 z1 ^0 ]& j- _. o
Fragment size=1024 (log=0)
. K! z9 e& k7 Q/ ~- Q/ L 126480 inodes, 503968 blocks; r4 p* F& @+ g8 H& q- \
25198 blocks (5.00%) reserved for the super user5 W* f& |; l1 g# t
First data block=1( }* w, z' x3 a2 M& P# f8 v
62 block groups
3 ~9 P. }) n6 J: w9 j( v+ M7 b4 A 8192 blocks per group, 8192 fragments per group4 h) m/ }+ k6 |! a) {" B: `
2040 inodes per group+ H6 ~ u K5 Z1 g3 W, Z
Superblock backups stored on blocks:
" S* C+ J' g% ~1 |: T, t 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409 d: p' t* ?( ^1 j3 K0 @+ V: k" ?
Writing inode tables: done
0 C" T! \' I$ H2 g) d Creating journal (8192 blocks): done
0 H2 e7 a$ b* V9 { Writing superblocks and filesystem accounting information: done
5 v, T) q( K/ x: G" T, E This filesystem will be automatically checked every 30 mounts or9 U+ |$ ?2 F* i+ i
180 days, whichever comes first. Use tune2fs -c or -i to override.
: C; w, @/ Z; ~* U$ N文件系统 1K-块 已用 可用 已用% 挂载点8 j& v; }9 A+ K' |! b. w8 @0 G& Z: r4 A
/dev/sda3 3723848 705992 2828692 20% /# R$ o$ ^8 Q1 Y* ^; `3 ?) g
/dev/sda1 101089 9274 86596 10% /boot. q% b" `9 s) R; E( _; @* n
none 14520 0 14520 0% /dev/shm
* @; I9 [/ l7 B Y4 M //挂上新分区: j6 N% z& c; ^
- mount /dev/hda1 /home
" m9 a( ~# {1 A9 R A - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
* P. ]) v5 G2 x; d4 o /dev/sda3 3723848 705992 2828692 20% /
3 o: s( O* |4 u4 K /dev/sda1 101089 9274 86596 10% /boot) e2 M4 X1 Z6 s$ ~1 j4 N# u
none 14520 0 14520 0% /dev/shm
! o+ W8 C6 ?% W) `) Q /dev/hda1 488006 8239 454569 2% /home
' V3 I+ n/ k- _6 G, `
: i4 z2 m! O: R% B2 n自动挂载:
/ K' n* f2 ]/ x# e, K- vi /etc/fstab
/ N t: g; W+ c: y4 d/ P7 ?4 _
p6 T& i! Q8 u# b7 }) B- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
2 K; B: k2 E! {# H3 C - 2 D" I. e: c" \7 L/ y
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:( f4 R0 X# i. N! {
- mount /dev/sdb5 /mnt/ljp1; q9 E& f' h1 ?- g( }, ^
- ; t1 J9 q! e) ^# c/ j; H
- mount /dev/sdb6 /mnt/ljp2
复制代码 % u$ g c- I. r- }
2 P$ ?1 w7 J% h- w6 p6 ]
* ~! e+ {3 T; L# l8 h |
|