|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
; F) |, x2 }" S or: fdisk /dev/sdc (for the third SCSI disk)) z. A I2 T7 R! J" {
or: fdisk /dev/eda (for the first PS/2 ESDI drive)4 {1 s5 R2 ^& u
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
' ^+ \) q8 { X0 x( |5 q ...* h$ e$ p; q% S/ B) _
- df -k
3 f8 }2 p6 w' R9 q9 t$ r, [ - df -lh
: l! ^9 d3 L- S& o k, ~ - 查看有几块硬盘:fdisk -l
8 O+ }8 _7 x4 v1 T' f& a
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点" c6 b2 E2 d) S2 {4 n3 _8 L
/dev/sda3 3723848 705968 2828716 20% /
" K: g* F% D7 M /dev/sda1 101089 9274 86596 10% /boot
- D; ? T# a8 X% K' L" X none 14520 0 14520 0% /dev/shm
% V& k& @2 m$ a4 k4 M9 g% o( x: H 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
# i3 t) n" | B: DDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel! M# r: N. M9 q
Building a new DOS disklabel. Changes will remain in memory only,+ c6 Y5 x9 \9 @5 l$ m2 z
until you decide to write them. After that, of course, the previous( F1 M7 H7 v7 r; I
content won't be recoverable.
; d' d `; \, i$ J/ ?7 K4 Q The number of cylinders for this disk is set to 8322.: u; `3 c, X$ P+ K9 B, [
There is nothing wrong with that, but this is larger than 1024,& U+ O7 G4 }& Q( H* L/ F, P
and could in certain setups cause problems with:/ B& Z* X Y! o; n5 a+ S
1) software that runs at boot time (e.g., old versions of LILO)! \( T' G' t0 B- x# Z
2) booting and partitioning software from other OSs# a6 c: Z) I1 L5 {( G
(e.g., DOS FDISK, OS/2 FDISK)2 K& N3 ]7 d3 A2 u& G5 r6 p6 T
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)/ y8 F: Y+ n8 Q
Command (m for help): p
& _% z2 w" e" c$ C Disk /dev/hda: 4294 MB, 4294967296 bytes7 y( U4 g& p7 U9 h5 ?
16 heads, 63 sectors/track, 8322 cylinders V0 {9 l/ {8 s1 F1 g) Y) l
Units = cylinders of 1008 * 512 = 516096 bytes0 a( `# O7 |: R8 }5 `( e: `/ @5 w
Device Boot Start End Blocks Id System1 H$ b/ r9 Q! `7 G+ Q9 c: v
Command (m for help): m. K9 ^. Q- {0 ~7 o/ T
Command action
5 j$ x1 ?3 P, B# x/ D a toggle a bootable flag
% ?. O R8 L, G( b, C g b edit bsd disklabel
3 t. D; D' t4 c) v1 L c toggle the dos compatibility flag' W k2 _2 F/ g, l+ L
d delete a partition
`1 x9 h7 [/ e% W l list known partition types
' f. k3 M$ o( F/ u# P0 A w m print this menu$ j: e5 B m* X% P
n add a new partition, e8 r" \' ]) c/ u; C
o create a new empty DOS partition table
8 D' c$ h. ]9 L p print the partition table R' H$ r1 q% X" {" ~9 G
q quit without saving changes/ q( y- @5 M2 C* Q ^0 {% T. d
s create a new empty Sun disklabel1 Z" c9 {) h; l
t change a partition's system id* a' x+ `3 |* \' d4 V
u change display/entry units
5 x2 R5 x- R3 D% u: ?' K v verify the partition table" W1 d4 ~, r) A k% G3 I
w write table to disk and exit
% {, B3 f& m4 i, j( z x extra functionality (experts only)
7 k- l% w2 e6 V M7 f) l$ [ Command (m for help): n
) S% T9 [: @: ? Command action
! e* W" T4 | x# ~- z# K! i- | e extended6 R4 Y4 d$ j k) x: s, M' K
p primary partition (1-4)
! r% a: [. x4 `4 c8 C% W% P8 j: K p8 c! G6 S) |/ R2 `$ f
Partition number (1-4): 1
, [* h% g) O/ C/ S/ Y$ h First cylinder (1-8322, default 1): 2 f0 w6 ]/ v" ~+ Z
Using default value 1
8 o& N/ d* j- K9 i Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G2 d/ o4 ]: C/ M1 \6 }
Command (m for help): p7 @5 t; ?$ _9 W; [3 w8 h
Disk /dev/hda: 4294 MB, 4294967296 bytes
1 i8 y$ [- ]. M6 d. Y3 D; N P 16 heads, 63 sectors/track, 8322 cylinders
5 ?! n+ Q" O1 f; Z5 q9 _8 f Units = cylinders of 1008 * 512 = 516096 bytes
! }* s. J9 c/ J8 Y2 v1 y% j7 | Device Boot Start End Blocks Id System
1 N9 M! z* r# D' N# r+ b6 L /dev/hda1 1 1000 503968+ 83 Linux& Z v' {3 F. a: s2 ]- e
Command (m for help): w
7 }# T) t; D% F" o4 B' F The partition table has been altered!
. l) h; a, J* Q8 C' Y4 u, a9 k Calling ioctl() to re-read partition table.% U3 s7 J* o; {% y
Syncing disks.8 @4 G3 G5 b6 a; o) C
//格式化新分区
1 D* w& |6 g$ Y4 Q4 pmke2fs 1.32 (09-Nov-2002) y9 ]5 d8 i) U* \ ~6 P0 F, |
Filesystem label=
! C3 e9 H$ ?- T5 I) S OS type: Linux4 \9 p0 p( S/ |2 }7 F. [# |/ A
Block size=1024 (log=0)
( R; ?, s; M& V( Q3 I m Fragment size=1024 (log=0). h7 f( Q [& F& l8 Q
126480 inodes, 503968 blocks
! p9 l( F) Y$ W, w- m! h 25198 blocks (5.00%) reserved for the super user$ ^$ B- t6 N7 v
First data block=16 G- `, O5 j. z4 i L
62 block groups
9 R+ B( w& e( h ~! {' c 8192 blocks per group, 8192 fragments per group
9 U2 T% V" q6 k$ y 2040 inodes per group2 I/ f! e6 M# |) ], H, m4 _
Superblock backups stored on blocks: / A0 i" D z+ q$ |8 v5 M
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
- p4 u% V+ x- W8 W- U% U) Z Writing inode tables: done
0 u+ ?+ z& W3 O" e: k Creating journal (8192 blocks): done( p6 [ u _* g
Writing superblocks and filesystem accounting information: done
# ]* m: M7 ^4 F8 A This filesystem will be automatically checked every 30 mounts or
/ J! j# z* m7 ^: i" t3 R5 E9 ]$ [; b$ j 180 days, whichever comes first. Use tune2fs -c or -i to override.' w8 y. y- q2 _5 Y) T/ h' B% @
文件系统 1K-块 已用 可用 已用% 挂载点
* I* W7 H+ U: i2 _9 {. @7 Y! B /dev/sda3 3723848 705992 2828692 20% /4 r# p! A1 I( I2 }- F4 W; }. s# Q
/dev/sda1 101089 9274 86596 10% /boot8 E' T1 w4 \& V6 C, I e
none 14520 0 14520 0% /dev/shm' B/ q; E2 u) I6 O
//挂上新分区
* i. Q- f4 w* o: {: O0 c4 Z- mount /dev/hda1 /home
& t5 V$ J- a3 ]: i - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
$ i. H H% Y _/ J* B& B& | /dev/sda3 3723848 705992 2828692 20% /
# g3 X- w5 g. N1 V0 `) A /dev/sda1 101089 9274 86596 10% /boot
9 P8 }7 p& |0 x" l' x& T/ V3 X none 14520 0 14520 0% /dev/shm
5 N3 V/ B4 z7 [) I5 n% q. N0 L: D9 P /dev/hda1 488006 8239 454569 2% /home
$ Q2 k3 D* D6 t7 `
. ?/ h8 Y2 J+ v自动挂载:
1 m; O# Q A- z* g9 F6 N: W1 h/ Q9 s7 r- vi /etc/fstab. p+ B1 j' C j
: M* ~$ N& r7 s- }5 N- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
& |) x. t: J# v1 m/ T; _ - / h1 R9 F. \) w# Z4 _
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:6 e/ b; @/ n+ n+ H4 C Y9 [" R. ?
- mount /dev/sdb5 /mnt/ljp1/ [' Z! @+ D4 m, W
- ; [/ k& R7 g* k. S$ n) k
- mount /dev/sdb6 /mnt/ljp2
复制代码
/ \9 [, K' j) ?
# i7 O$ t) C0 ~- _! H6 n
8 @3 t- b( |5 n% y |
|