|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)6 A3 a, ?& M7 h7 w
or: fdisk /dev/sdc (for the third SCSI disk)3 E1 g4 V; P* p( I5 D6 z' W( ]
or: fdisk /dev/eda (for the first PS/2 ESDI drive)- N q1 @2 W/ K8 q- L, F/ C* {
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)& V: J( Y: I; u" |/ I
...4 R' k9 F W2 z0 c7 J( ^5 v% x5 ?
- df -k2 h" `. l" w7 z* c' `& r7 R
- df -lh. z- d7 W. S% a9 c4 _3 Z
- 查看有几块硬盘:fdisk -l8 T# j7 e: `( _) B& o
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
. g1 O( _" O9 U /dev/sda3 3723848 705968 2828716 20% /
4 P b% w, |$ j- c2 ]6 r- ~% x5 e /dev/sda1 101089 9274 86596 10% /boot/ Q8 j1 r( i' ?7 c( M' T
none 14520 0 14520 0% /dev/shm
% y5 Y& O/ x4 K5 Q9 C* C4 H& [ 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
0 u/ J% @% w- R' L9 uDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
) l+ U+ q2 n5 W0 b Building a new DOS disklabel. Changes will remain in memory only,
4 h5 [* w: ~1 @& Z until you decide to write them. After that, of course, the previous2 v3 e+ k; U4 z. E' N
content won't be recoverable.: Q! k R+ s5 T N* U; _
The number of cylinders for this disk is set to 8322.7 x/ e' a8 g: ~5 v7 U
There is nothing wrong with that, but this is larger than 1024,9 t" Z) ]* H7 i" J: `
and could in certain setups cause problems with:
( t6 H% X) P& E: T5 r3 Q 1) software that runs at boot time (e.g., old versions of LILO)
! l! p7 |; _6 Q* t 2) booting and partitioning software from other OSs4 C) m6 {( X% l" Y7 R* o
(e.g., DOS FDISK, OS/2 FDISK)
4 a- N4 S2 n* a+ P# q9 U! `; M Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
) g3 G3 T* M6 i$ s- T Command (m for help): p* g, E5 r" E) S
Disk /dev/hda: 4294 MB, 4294967296 bytes
1 e9 i/ }9 w2 X/ m! z7 z 16 heads, 63 sectors/track, 8322 cylinders
( V) r, s8 B' M( ]9 N7 J, n Units = cylinders of 1008 * 512 = 516096 bytes. F. n1 E: h* }
Device Boot Start End Blocks Id System
0 `3 }! g6 I& ~ Command (m for help): m
+ C$ [# u2 O$ I Command action
# j$ C! s) m/ r% J a toggle a bootable flag
' G: [' Y% Q. Y+ x6 ? b edit bsd disklabel
+ J# J+ O7 _! |% D0 A c toggle the dos compatibility flag$ F3 }$ e; d. i
d delete a partition
8 j7 h0 R( I' c) o+ S l list known partition types* V5 [) w- W' Q% T- H: O
m print this menu
4 H6 r; W& N S* p4 S8 c1 W! p& o n add a new partition, N/ h0 \; y3 O# |. t
o create a new empty DOS partition table
% S# _( k2 d4 U5 e% Q" Q; s6 e p print the partition table
! g" c( v9 E: q q quit without saving changes
/ m. P* N! R, J) q) u0 r5 } s create a new empty Sun disklabel# k7 n+ a S" w! u9 V/ S4 U
t change a partition's system id
0 v9 \3 F9 B8 [, J" a u change display/entry units0 h4 H/ z$ N8 |8 o. L- x* ~) _) I
v verify the partition table
/ [3 M7 N" n2 S- w% | w write table to disk and exit& y9 Q" Q8 H- @: M2 P4 \8 @" L
x extra functionality (experts only)) P& ~& h. C, Y
Command (m for help): n
/ h1 f5 N8 [* v) Y Command action! E! c. q. @. A, S$ v
e extended1 w) j& ?, Q' W' w$ `
p primary partition (1-4)0 W) @4 e4 x5 |" d# g$ W _' p
p/ Y" C8 Y1 W2 w
Partition number (1-4): 1& x: a$ }) B& ?* ~) Y
First cylinder (1-8322, default 1): ' l6 J9 a. Y6 T( b# @3 N" O
Using default value 1
9 ^* M; _2 y2 ]6 O5 Y% ~. P o" R Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
% s) J& h0 H0 j) c1 f3 E; f M Command (m for help): p
6 V5 B1 g, R/ P" J' T( e6 A& A Disk /dev/hda: 4294 MB, 4294967296 bytes( _: K+ R1 [9 E; _' f5 x0 K$ ^" p' c
16 heads, 63 sectors/track, 8322 cylinders* S: C1 i- a6 s; l
Units = cylinders of 1008 * 512 = 516096 bytes
& i$ _1 G, p8 j/ d, q. q Device Boot Start End Blocks Id System
( _9 v h2 F l5 a7 X; ? /dev/hda1 1 1000 503968+ 83 Linux: n& U3 D4 A4 t* t& P+ y& o( X
Command (m for help): w
' X; V( G8 \# |5 ?4 T3 X. j The partition table has been altered!
2 k/ o- r+ H$ u+ L7 a G- R Calling ioctl() to re-read partition table.
* b0 B5 w4 z. k* i. T x! ~/ F Syncing disks.
% d8 N. K* z8 r8 I //格式化新分区+ [, a) `1 h% T; d; F& o
mke2fs 1.32 (09-Nov-2002)
3 h- q- w1 q" r/ u( L, w% k! } Filesystem label=% l2 v) I6 I0 n1 A& |' N
OS type: Linux
/ W% X% ?* n9 L& a9 D' y/ W4 s3 _ Block size=1024 (log=0): P7 N4 s% X0 R$ Z$ h+ h1 @
Fragment size=1024 (log=0)
6 I+ V/ `& {* k+ q 126480 inodes, 503968 blocks
/ Z6 c$ J( m3 h2 C# d. C& t' Z+ N 25198 blocks (5.00%) reserved for the super user( H( M2 c; {$ K; U: b1 g4 c1 P
First data block=1
7 @5 F( w2 ^! f2 z 62 block groups& i1 g) o# }+ @7 J
8192 blocks per group, 8192 fragments per group- l) q3 [$ m4 Z$ v' P
2040 inodes per group) Y% p/ T, i5 ]1 P- O
Superblock backups stored on blocks:
: r/ s- U+ h8 N( C1 N- O, Y% h, ? 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
* {. V l$ f+ w- v) `7 o: R Writing inode tables: done
% {$ C4 t5 r# }/ |/ ^ Creating journal (8192 blocks): done
4 L" \' g X) Z* g; Q# F% V( L Writing superblocks and filesystem accounting information: done
% d* a* e5 G( a& {6 [4 L5 a- F+ H This filesystem will be automatically checked every 30 mounts or+ \. B4 a7 B. b
180 days, whichever comes first. Use tune2fs -c or -i to override.
& A: V8 G% H9 a$ o- A0 p8 ]4 ~文件系统 1K-块 已用 可用 已用% 挂载点# Q2 }/ Z( U9 }6 n; ], }
/dev/sda3 3723848 705992 2828692 20% /) y+ F! s' q# {! f
/dev/sda1 101089 9274 86596 10% /boot
: i! g9 `- k" ^ none 14520 0 14520 0% /dev/shm+ H; ~" W7 K+ Q# W
//挂上新分区
- z( r/ l( t9 I* B1 C- mount /dev/hda1 /home, K. E( A* J, O$ Q0 b; ]: }
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点2 B5 a# Q/ J+ m- v( Z& T
/dev/sda3 3723848 705992 2828692 20% /
% Z0 i4 `( c4 t5 B+ x /dev/sda1 101089 9274 86596 10% /boot! W7 u/ w5 e- Y, x* A3 O, a# _
none 14520 0 14520 0% /dev/shm9 s, P' i- w! r5 @" _8 _
/dev/hda1 488006 8239 454569 2% /home
n& v0 [5 c5 o+ I
$ m, ]: z% ]5 o9 r) s自动挂载:
, q; v; z( l' T; u+ ]. ~1 v0 I- vi /etc/fstab6 e$ G2 a! F5 s" I. j
9 w* b5 t( |' Q- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
. i) u- m) U4 V2 x$ d/ c' F7 R# k
$ d0 d& ]; U' Y+ I0 O, N' x; y' P, b- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
, O5 B5 Y7 L% L- mount /dev/sdb5 /mnt/ljp14 E+ Y( n+ |6 U; e, S% S% ?( j
- / i. q" |, e5 s) y# o1 [; I6 Y
- mount /dev/sdb6 /mnt/ljp2
复制代码 * {$ ]; S6 g; A2 x/ @
5 F* d0 u8 W+ e' k, {: @% F- s% v1 @3 z+ |9 _
|
|