|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)8 N, E$ N D+ l3 k
or: fdisk /dev/sdc (for the third SCSI disk)
3 Y. j- M' x9 f1 t0 ~6 u+ H; p or: fdisk /dev/eda (for the first PS/2 ESDI drive)3 \/ M$ ?: F+ r# V5 S$ i/ w4 w5 g9 f0 [
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
7 _( q0 `( q% d: w U; M ...6 w ?/ r3 s- {9 {/ R% F
- df -k' r0 n I2 E9 A$ \: V! n
- df -lh
( S" q; S- _7 x/ y$ l, P - 查看有几块硬盘:fdisk -l* ~3 V8 W. | u! Q. B
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
3 Y- o' M8 z" d' q- r /dev/sda3 3723848 705968 2828716 20% / n: a. Q& ]3 u$ s6 V
/dev/sda1 101089 9274 86596 10% /boot
3 U% X9 l9 H: S+ f9 L: U none 14520 0 14520 0% /dev/shm- J: B. x( D1 \2 C m
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
# i$ ?5 H0 K# `; Z4 u6 cDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel( S. ^) y0 z) R/ U1 J2 U) A
Building a new DOS disklabel. Changes will remain in memory only,
) G% ?% E* Q! k7 T( S until you decide to write them. After that, of course, the previous2 t* d; ~8 d3 C" n6 A
content won't be recoverable.
1 z! @: h' @8 R, H. e. T The number of cylinders for this disk is set to 8322.1 I# v# `9 |, ?; K% O/ I; A
There is nothing wrong with that, but this is larger than 1024,
3 F# X* ~) K* u! n7 d/ R& k and could in certain setups cause problems with:
8 t5 w: D9 G" u& b 1) software that runs at boot time (e.g., old versions of LILO)3 g( P7 b; W# S% b2 g6 o0 h
2) booting and partitioning software from other OSs0 D& k, X0 T: m0 Z: f5 a- i2 C$ z7 G/ I
(e.g., DOS FDISK, OS/2 FDISK)
4 E+ Z7 z9 @' @! |; |/ H8 e6 k Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)) J8 F1 z8 N$ t! ~# M7 Z
Command (m for help): p+ d7 K c+ p! J8 L
Disk /dev/hda: 4294 MB, 4294967296 bytes
/ [6 b9 |( A1 H3 n 16 heads, 63 sectors/track, 8322 cylinders+ r: q$ C9 p, R' c, ^4 i
Units = cylinders of 1008 * 512 = 516096 bytes
3 A9 Z# F D) @ A- u Device Boot Start End Blocks Id System9 `' [, Z; `3 e, k" ]5 k
Command (m for help): m
1 ~8 ?" [7 ~: ?5 T: |& W1 e Command action, P! c: }" O) M
a toggle a bootable flag2 Q/ E) n- X. K V5 o- U
b edit bsd disklabel
1 T! t/ s; V% o' |6 R6 t4 Y4 R c toggle the dos compatibility flag
$ d* o2 \* ~. A6 W$ `7 z" q' ] d delete a partition, T- E& H$ {( t0 {, e& S
l list known partition types
. {. r" b% F$ A: D) u m print this menu
3 W: f: w3 g$ V ` n add a new partition) I) M% c7 m2 U" V2 z; D: V
o create a new empty DOS partition table
3 B9 R8 r) t7 X- A5 k p print the partition table$ g& z- n" B2 m8 t
q quit without saving changes/ v) n$ a; ~ g6 k( R8 S3 n; O* w. B: ]
s create a new empty Sun disklabel% f2 m! x$ u1 e* Q% J* }
t change a partition's system id |; J! I9 {" y/ B: W
u change display/entry units: L/ ~2 [7 X! v) L0 t. t
v verify the partition table
8 X& o. a X: R+ [ w write table to disk and exit. M; I0 P) @7 v/ p8 l
x extra functionality (experts only)9 A7 z. k- q" x2 {( k
Command (m for help): n4 q5 h; }3 |, j* M
Command action
# s5 M \- M% q0 h' O e extended
8 g/ K' h0 ?- }! J4 ]( [7 V p primary partition (1-4)* w, x+ q( R4 `4 V" v
p
! R! b& h- m4 z; W. e Partition number (1-4): 1* x" q! s% b. ^: ]
First cylinder (1-8322, default 1):
: C" @' ~* }% b4 _7 v( h Using default value 1
7 O# u* h" _% y Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
6 C4 S9 I9 `9 q( h* X$ z Command (m for help): p
& d/ L J6 p( Z. ?" R Disk /dev/hda: 4294 MB, 4294967296 bytes1 h, g! i' U& ~+ R8 @% @2 D
16 heads, 63 sectors/track, 8322 cylinders
1 s) s$ ?. g& }! ^1 I/ | Units = cylinders of 1008 * 512 = 516096 bytes% w5 a' {% o; `$ }0 _
Device Boot Start End Blocks Id System
$ A. t" L. _8 Z: I( f% A /dev/hda1 1 1000 503968+ 83 Linux
6 J2 v4 ^1 a# Q Command (m for help): w
# r5 Y- i& P: U3 h: O The partition table has been altered!
; m- \; q# Z# _ Calling ioctl() to re-read partition table.- A( I3 K2 ^1 h3 H) N7 E
Syncing disks.9 B5 I! M4 x c1 _; C$ F
//格式化新分区
0 d/ z' l2 p( k- \- w, o7 _mke2fs 1.32 (09-Nov-2002)# c4 b3 H/ s( @' Q }1 I
Filesystem label=6 p1 a9 ^; D1 |! h
OS type: Linux4 t( @, W9 f, c2 T
Block size=1024 (log=0)
0 w+ |6 l: ~# C7 O6 B. p w Fragment size=1024 (log=0)
) ~7 k0 m- ?, V3 N 126480 inodes, 503968 blocks
( f! c1 t# ~4 k1 A! I/ Y 25198 blocks (5.00%) reserved for the super user
^+ k, n- h1 x( N2 H4 ? First data block=1
$ |0 b B/ R4 \, m8 v- c" a- ^ 62 block groups
9 J1 w4 z( y" D4 k+ { 8192 blocks per group, 8192 fragments per group
. l/ w) H" |8 H! ?) H1 c 2040 inodes per group
' h/ P1 ^& Q# G( h! P% O Superblock backups stored on blocks: 5 h- }) q7 [/ l1 f2 Y* j
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014098 n$ V' R" C5 A9 c5 }9 h! V
Writing inode tables: done
, @$ s) O! u$ ]4 a0 W$ l: y Creating journal (8192 blocks): done
' Q9 A" `2 G9 O |, o' f5 `; a% e Writing superblocks and filesystem accounting information: done- w5 x1 v& i7 E# ]* M
This filesystem will be automatically checked every 30 mounts or
+ w k2 p/ m7 z5 _" m 180 days, whichever comes first. Use tune2fs -c or -i to override.
/ ~- j5 I, V# O" E6 r- a8 p* g. c" Q文件系统 1K-块 已用 可用 已用% 挂载点( c; I. L+ X* f4 Q0 s d( I7 `
/dev/sda3 3723848 705992 2828692 20% /5 u7 ]- B' d' s4 Y1 P& O7 f! K
/dev/sda1 101089 9274 86596 10% /boot
0 o3 }3 p2 g' D* Q& b+ a& s none 14520 0 14520 0% /dev/shm
. B! q9 J# i1 o$ G; { //挂上新分区
; h8 V5 f8 v- d3 H* J% h. U! N0 p- mount /dev/hda1 /home8 A, r% T4 O7 w) ?' [4 N4 D+ ?
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
! a3 W- M& D! c& b /dev/sda3 3723848 705992 2828692 20% /
, ]; c# O3 O% ]! f8 I- }, X0 ~/ G /dev/sda1 101089 9274 86596 10% /boot
% w3 g+ p; j# E none 14520 0 14520 0% /dev/shm3 ^" G! B2 l$ V: E. ^" z: ^
/dev/hda1 488006 8239 454569 2% /home7 c' F( E, E% J# M" V/ a- J7 n+ b
9 j5 r( t( d3 {% s5 w
自动挂载:; u! Z9 D, A2 z7 s. q
- vi /etc/fstab) N1 }1 s' h' R6 i) P" {/ o
$ T: [9 Q6 ]1 V- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
/ f( k# s& u* m- o$ [9 ?
$ J- A) c) h' o' J7 N! C6 @- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
; W/ K: h2 \! _" w! t5 Q- mount /dev/sdb5 /mnt/ljp1( {9 e% w2 q3 D1 n0 b6 l4 `! I
- 3 u/ o5 r* {! j: ]. A
- mount /dev/sdb6 /mnt/ljp2
复制代码
' Z7 z) ?" X+ ]7 Z5 a% t& e) A/ O
0 U6 U* ^8 e* e/ {4 j0 L: a- h3 Z$ Y
|
|