|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)/ w5 D, r1 O8 |- b" p; m
or: fdisk /dev/sdc (for the third SCSI disk)- c) Q8 d6 b% T4 G
or: fdisk /dev/eda (for the first PS/2 ESDI drive)9 f5 B; |' k5 O( }7 v, j) q
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
& v9 n. N1 Q" _6 y, J% I ... `4 k$ [" `+ {( w
- df -k
5 w: @& z5 a1 _1 }" I! k - df -lh9 C+ b3 y8 g2 A0 h
- 查看有几块硬盘:fdisk -l
n& A* V }. L
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点) v: D+ m( V5 k$ O6 ~
/dev/sda3 3723848 705968 2828716 20% /( w4 j# g y, A/ \' Y1 l
/dev/sda1 101089 9274 86596 10% /boot
, r2 l0 O( u! f, j none 14520 0 14520 0% /dev/shm
a: g. ]1 w( t' p' ] 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用; `4 H/ k) T0 @% P3 |. O
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
0 a' g( O$ L8 A0 \3 S, v Building a new DOS disklabel. Changes will remain in memory only,
" I/ y: Z5 s4 u% Z until you decide to write them. After that, of course, the previous
7 ~6 y$ w( R0 b5 u- N7 J& e content won't be recoverable.! `" {" G1 ~. i5 r
The number of cylinders for this disk is set to 8322.
! b/ C' H0 Q& D% f! i3 M There is nothing wrong with that, but this is larger than 1024,
- ` ?, x o. Y4 t+ y1 f' g and could in certain setups cause problems with:) O( V" `* B0 u" H0 a3 B
1) software that runs at boot time (e.g., old versions of LILO)
! `% T* Y; `) w/ Y) ~ 2) booting and partitioning software from other OSs
, A* \, \ o' m5 g6 T- t0 l: Q (e.g., DOS FDISK, OS/2 FDISK)$ p! C: c" r+ J2 i% f; H
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
3 y G. Y1 {. I6 V9 D/ v Command (m for help): p: }& J( z/ U0 j
Disk /dev/hda: 4294 MB, 4294967296 bytes9 r0 c9 g* V: ?5 Y7 k2 K5 c
16 heads, 63 sectors/track, 8322 cylinders
' h9 N Z5 _9 M$ g Units = cylinders of 1008 * 512 = 516096 bytes
( {: P1 }/ n% V: t Device Boot Start End Blocks Id System
6 ?. }$ q7 o" X+ e, N8 W Command (m for help): m7 [4 ] Z4 i/ y H( C2 _- D, |( w7 \
Command action
; Q' J! v2 f4 |1 [% v a toggle a bootable flag
, e8 B. F+ I3 G5 H6 g b edit bsd disklabel
. c) C( R: R0 }1 A! P( |; i: ~ c toggle the dos compatibility flag6 v; S' m3 z0 I
d delete a partition
" S7 T8 k3 ?' q l list known partition types
) ]8 Z7 F5 k. @* Y8 P9 d m print this menu7 C* s; ~; q' Z9 x, o
n add a new partition @7 V, I5 X* n
o create a new empty DOS partition table& x5 ]5 v1 K2 }0 \
p print the partition table
! [$ L4 j2 ]3 w- Z2 Z/ z* x q quit without saving changes1 P V1 a7 b1 [! x! `, _
s create a new empty Sun disklabel
, R$ R. _) ^# G$ X1 P t change a partition's system id; {$ y2 E: H* X% `
u change display/entry units
$ Q( |' q1 [% d; I v verify the partition table6 o7 @' l) {* C4 i2 }+ _
w write table to disk and exit! @6 J$ K# U6 ?/ l3 T% Z O
x extra functionality (experts only)
U5 C7 a1 `7 t% q* n# N' l Command (m for help): n
) h7 C5 V& ?8 A5 p) w Command action7 Q4 Z5 M3 Q7 q
e extended
! K! F% P% ~0 ^1 p p primary partition (1-4)
3 \: n* V9 [( j/ x p
2 j3 e W1 e& u7 {6 v) c& b3 B Partition number (1-4): 1
0 Q6 o' i1 X0 l- ^ First cylinder (1-8322, default 1):
. ^0 A$ @( y! o7 P# N/ C. n0 Z# U Using default value 1
; O- w/ i* G+ E/ X Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G" s1 a# c5 H8 f4 }4 d
Command (m for help): p
+ a$ T' H' {* n/ G Disk /dev/hda: 4294 MB, 4294967296 bytes
# Z5 j3 E5 I/ V& Z1 [5 ` 16 heads, 63 sectors/track, 8322 cylinders
- o0 ~5 S& X! C Units = cylinders of 1008 * 512 = 516096 bytes
6 ^( g! R4 ~8 c- E1 c Device Boot Start End Blocks Id System6 P/ i4 w! Y9 l# h" v9 p- K: |8 a& C- Z
/dev/hda1 1 1000 503968+ 83 Linux% t' Y1 O( A5 w+ L% r( y% Y
Command (m for help): w* c* L4 C% G* F
The partition table has been altered!
2 |. V$ h! b1 m+ L, d5 c g Calling ioctl() to re-read partition table.- C2 ^& K* S) e( M) g
Syncing disks.
! r' _. F7 X1 A. |2 p9 r+ S+ E/ s //格式化新分区
, \) {& O" L4 `0 H" r) G+ R# l ?mke2fs 1.32 (09-Nov-2002); R2 Z/ c, `) R# z* [
Filesystem label=$ R7 Y* \; C' e `
OS type: Linux) C/ u; H% i* r. }8 q3 a
Block size=1024 (log=0)9 C/ I3 h( C' N( r0 w4 X1 N+ e( w1 X
Fragment size=1024 (log=0); H1 y2 [) j+ i
126480 inodes, 503968 blocks( d* }% N( w; y3 `/ A9 K' K4 l
25198 blocks (5.00%) reserved for the super user
- s1 h# o* r6 u& L8 o+ d First data block=1
# }2 c% U- ]2 M' i4 o% e8 b8 ^ 62 block groups
; \( Z1 O9 j1 E* N6 k: \& L: V, ] 8192 blocks per group, 8192 fragments per group9 s# ]& B, L0 g( `% S
2040 inodes per group$ Z+ F1 C9 o; I# W
Superblock backups stored on blocks: ! e0 q" p0 \. E& n0 Z9 J3 i, c* e+ d
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
. ]6 q# [4 j$ Q0 m% U# i Writing inode tables: done
. W h) X: ~* r: X9 G3 V* X Creating journal (8192 blocks): done. N; L E7 n; T$ T( E- K
Writing superblocks and filesystem accounting information: done1 Z3 d& _! N9 X3 Q0 G; E. H
This filesystem will be automatically checked every 30 mounts or
4 d( o6 w5 x# ?& |" |9 z+ \ 180 days, whichever comes first. Use tune2fs -c or -i to override.2 Y0 m- L$ d# K& }
文件系统 1K-块 已用 可用 已用% 挂载点
5 _* U; @* V# b/ Q$ U' k, t /dev/sda3 3723848 705992 2828692 20% /
4 t; v* ^0 R& M! i& T+ t /dev/sda1 101089 9274 86596 10% /boot
3 R& Q$ _& q7 }1 r' H none 14520 0 14520 0% /dev/shm
& r% n2 A9 @* Z8 A9 S0 u$ b2 e, s //挂上新分区
- M8 n2 |/ H0 J6 T4 \- mount /dev/hda1 /home& T- ^; Y) U/ h: d& a( ~3 s( ^
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点' d& k; M% V9 M! G) @
/dev/sda3 3723848 705992 2828692 20% /
2 g9 j( \' s2 O* Y& D B$ Z /dev/sda1 101089 9274 86596 10% /boot
9 V& A4 e6 w9 W none 14520 0 14520 0% /dev/shm) y% ~! U. q& x; v6 ?
/dev/hda1 488006 8239 454569 2% /home# T* M8 [$ \/ ^) Q6 w7 B! K5 @" b6 r
0 F4 J9 S/ c; L( Z- L3 q5 C自动挂载:8 |* y6 g, O, v8 U
- vi /etc/fstab w9 n w" N7 l' x# {6 e6 J
- 4 k0 R- f5 t2 U L4 J0 n) B
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0- w0 R# H! K7 F; L
. q) N0 s$ Z7 |+ W" p" ]3 Y6 E- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:8 i# E) z- K9 \+ [7 ~
- mount /dev/sdb5 /mnt/ljp1+ ]& ^) R. ^% @3 D! x! G
7 p% U6 k' R4 G% u- mount /dev/sdb6 /mnt/ljp2
复制代码 - c$ x% a$ P- r6 d6 v$ [8 y9 A
& t# y7 ]3 \4 N5 [, I, f: S9 j, |4 N! `: C* Z1 n
|
|