|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
: U- @% j+ o+ m( m I; ] A9 B or: fdisk /dev/sdc (for the third SCSI disk)% M2 v- Z' Y% s7 V2 t2 _7 g
or: fdisk /dev/eda (for the first PS/2 ESDI drive)1 R2 c. J( _3 z. ^1 t" G7 R% z" j
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)9 ~% v/ e9 S; J$ d
...1 m+ e2 o0 b9 L$ `) ?
- df -k- M' z7 m) a$ z( S- e$ i8 T
- df -lh/ e( M& h% P5 o' C
- 查看有几块硬盘:fdisk -l6 u! r( M; ~9 G" G% [7 Y5 t6 d+ T
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点 }# {; e2 k5 S6 q" A5 X
/dev/sda3 3723848 705968 2828716 20% /2 _! ]/ U) Z1 L9 q
/dev/sda1 101089 9274 86596 10% /boot
5 v, V0 K- l7 g$ @ none 14520 0 14520 0% /dev/shm. i8 Y3 `: e( O4 C
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
{' g$ }5 L' p6 `5 Z4 UDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
- S0 _7 k* N! a- o. i( q7 p6 F Building a new DOS disklabel. Changes will remain in memory only,3 s+ s$ | {; _5 k% r! A
until you decide to write them. After that, of course, the previous4 Z" j) k7 g( Z
content won't be recoverable.4 j) {# n$ x. ?1 H% p6 `# c; T
The number of cylinders for this disk is set to 8322.
$ l$ z% s5 }# o5 J& S( I There is nothing wrong with that, but this is larger than 1024,
- G2 W {* h0 F, W+ B and could in certain setups cause problems with:
l0 g# k6 k9 D0 t x. ?* M8 Y! x% ` 1) software that runs at boot time (e.g., old versions of LILO)) d5 e3 ]) d n8 p
2) booting and partitioning software from other OSs
$ M) v4 N0 u+ _( w- B (e.g., DOS FDISK, OS/2 FDISK)
. V+ \0 P( D6 t7 j7 ]9 j$ O* D% d8 G7 q Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
o' c; W& t! N Command (m for help): p7 C3 N3 j x) g2 V" h
Disk /dev/hda: 4294 MB, 4294967296 bytes
9 ~6 ] f6 \& q9 s$ X 16 heads, 63 sectors/track, 8322 cylinders
; Q& g7 Q6 v# H* O7 d1 F$ F Units = cylinders of 1008 * 512 = 516096 bytes
1 Q8 r) ~+ v, H9 ~0 {5 p Device Boot Start End Blocks Id System
o5 Y1 u& F9 k# M# J1 `" j Command (m for help): m
3 S9 l! k1 f2 i' ~9 p/ E" B Command action
7 R' y3 D/ g; Q a toggle a bootable flag8 b! ?! R& [' [4 L( i; b( y J
b edit bsd disklabel( x9 Y, J, z6 M U: o+ M9 l% f
c toggle the dos compatibility flag: D6 l% w: }# H4 P* S9 x8 F( g5 Z
d delete a partition
2 ]- q; V6 u3 C) x& ]8 ?) p* E/ B l list known partition types
$ w4 a/ h! o+ C+ V) } m$ { m print this menu
; i/ i4 x. w/ ^+ M: R n add a new partition5 l) ^, |0 I; }
o create a new empty DOS partition table0 S% Y8 Z# d/ f
p print the partition table
: z" S+ z1 L+ R' C9 ? q quit without saving changes
+ g4 I1 T8 Q, K3 B1 ^6 F) _3 i s create a new empty Sun disklabel1 w% T1 U8 k! i( r$ ?4 p1 H& Z
t change a partition's system id
9 T2 N+ P% l9 r u change display/entry units
+ w0 f1 p4 \/ ~/ \8 q9 L v verify the partition table* d+ ?& q4 v" g( o0 l
w write table to disk and exit$ l1 k1 r, j" ~1 F+ D. n. Y
x extra functionality (experts only)
7 A& c) m" m' v y Command (m for help): n
- u3 `+ Y$ l0 ~% l5 ?3 g Command action9 q: |7 d j6 ?: I
e extended; A* T* v# Z- o; P
p primary partition (1-4)
3 p9 [4 H# [0 z p
; ? e* e0 I0 U2 T; M- k6 R Partition number (1-4): 1+ \4 ^; `& g& W1 V4 p1 X8 p
First cylinder (1-8322, default 1): ) H4 ?6 G) {9 G
Using default value 1
- R4 p- p2 Z7 L Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
9 }! b: A$ V+ J3 a; k+ d1 _& b/ h Command (m for help): p
2 I5 `6 o3 H/ F3 v2 B* x0 ~ Disk /dev/hda: 4294 MB, 4294967296 bytes
9 D) L7 W! I+ G* \5 `8 k, f* y7 ]" i 16 heads, 63 sectors/track, 8322 cylinders
7 a Z/ a2 k0 b4 G! c Units = cylinders of 1008 * 512 = 516096 bytes
# d8 Z# M2 [. u: u, n; K Device Boot Start End Blocks Id System% _- B; e6 [ [# l0 U
/dev/hda1 1 1000 503968+ 83 Linux
" {' ?, k& t$ Q Command (m for help): w
# s; z- q- i7 P% c! c; x, a# g The partition table has been altered!
) o$ L3 C; G3 v. m/ i% U: {4 I Calling ioctl() to re-read partition table.
0 k" g2 h Z5 y3 Q9 }& ]$ L Syncing disks.0 x& @8 L9 _6 q# [7 K2 }+ [
//格式化新分区. Y5 [7 B8 e' C z6 Q& d
mke2fs 1.32 (09-Nov-2002)
: U' f/ q# |% `; p3 L Filesystem label=+ V, Q' L) k1 Y# o. ?) L# N
OS type: Linux
& p$ c4 y" G% E/ A# |2 N ~& q Block size=1024 (log=0)
* L* Y0 |1 `+ I5 @+ K, h. ]' S) { Fragment size=1024 (log=0)
! C) {) n1 a7 O) D 126480 inodes, 503968 blocks8 L0 c) r6 Q/ D1 y
25198 blocks (5.00%) reserved for the super user
) D4 j$ R N! V% _3 i First data block=1
" x8 A/ N% G p4 x8 c5 { 62 block groups; U6 D! s* [0 X% ]6 v# X
8192 blocks per group, 8192 fragments per group
% |: q& D) d$ `6 _( \4 M 2040 inodes per group/ p0 s8 e8 ^# G! I& Q9 H& ~
Superblock backups stored on blocks:
0 \$ R" W) B: Y z/ \4 [ 8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014096 o/ f6 R! J$ v
Writing inode tables: done " ~( E: s9 V# I h' u) t
Creating journal (8192 blocks): done
5 ^* n6 D* k2 R Writing superblocks and filesystem accounting information: done. @! @. q5 _ N+ h; a
This filesystem will be automatically checked every 30 mounts or1 t9 l: E8 ]6 Z1 t; ^
180 days, whichever comes first. Use tune2fs -c or -i to override.
9 |# s, C7 Z A5 @2 ^3 w6 K文件系统 1K-块 已用 可用 已用% 挂载点
5 h! Z: @) U% G/ D: i /dev/sda3 3723848 705992 2828692 20% /
6 g# d( Y! ?- \: w& d' h /dev/sda1 101089 9274 86596 10% /boot6 V D& X* R- j4 Q5 q8 i! a- {
none 14520 0 14520 0% /dev/shm" I4 u3 G. f0 ~
//挂上新分区
. Q0 R: ], E% {3 [+ ~+ }- mount /dev/hda1 /home) i B9 A" t* E! w% l
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点9 ~- F/ }1 [# R7 D- A
/dev/sda3 3723848 705992 2828692 20% /' ]( q9 A' w, p! k1 H* l) A
/dev/sda1 101089 9274 86596 10% /boot; c% R F7 R6 y& h: p
none 14520 0 14520 0% /dev/shm: W/ ^ `( c; l
/dev/hda1 488006 8239 454569 2% /home
. k6 C! B. k k9 Q' G1 ?2 C" A/ ]6 {- z" G' b1 X5 h
自动挂载:: o- o) v0 p0 W( K1 t9 I$ J9 I
- vi /etc/fstab
2 P* ^9 Z+ Q- S - $ q- \6 |5 X9 s3 X* W( e0 a
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
0 S& G+ m1 U/ F" q, a* R) M
" v5 p6 {7 a( `/ d# j5 O- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:9 \9 a/ y! W4 D5 G; S
- mount /dev/sdb5 /mnt/ljp1
+ g# @% R5 j" o
5 l4 ^+ D) @8 N* U% G- mount /dev/sdb6 /mnt/ljp2
复制代码 : ?; |2 C. `( @! |. C# ]) |6 |
w6 W5 I" v x. A% P5 F) G7 z# T2 m# q6 t3 f3 ?9 p, ^2 u
|
|