|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)( F: t6 _9 K9 W; l/ X
or: fdisk /dev/sdc (for the third SCSI disk)
6 q+ z" P, S$ m+ T or: fdisk /dev/eda (for the first PS/2 ESDI drive)
- P+ o. W% \% X) E4 e or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
/ ^ R0 Q0 ?# S. u5 k& G& Z ...8 r9 K4 f7 m# g/ K
- df -k* K5 {7 a; S6 Y! o; a
- df -lh K; f- h8 b4 ?6 ]: V; v5 c% b
- 查看有几块硬盘:fdisk -l
4 t0 m4 y3 E2 T" R9 i4 t
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
- e5 C& E( c9 K( V /dev/sda3 3723848 705968 2828716 20% /: C& Y" \. A" A1 D
/dev/sda1 101089 9274 86596 10% /boot
: L6 V2 z+ i7 k3 d) q8 ^5 A none 14520 0 14520 0% /dev/shm
$ \* L" e9 n$ l7 o" O! b X 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用' X: A# K5 T" o z8 \
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel8 R$ V; v2 e+ ?7 C! h
Building a new DOS disklabel. Changes will remain in memory only,
+ c: k) C7 O3 a9 Q until you decide to write them. After that, of course, the previous
2 p( {+ ]; T# N% L; h content won't be recoverable.& C0 n- ?: i% m! P, q$ i
The number of cylinders for this disk is set to 8322.
; c' I) F7 n' ~ V# M$ ^ There is nothing wrong with that, but this is larger than 1024,
( y; G: h0 c, a1 d, {$ H: a1 k2 q and could in certain setups cause problems with:
- y- }' s/ N/ J" e 1) software that runs at boot time (e.g., old versions of LILO)
& n6 c$ X% a5 T s! f' i0 E: V5 h 2) booting and partitioning software from other OSs6 d) x" n* Q! [" a g" \* T
(e.g., DOS FDISK, OS/2 FDISK)
2 v( @/ ~6 w. ?. [# U, h. V% b Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)0 D7 f. c4 z5 Y3 d7 q; x( B( {2 g
Command (m for help): p! e N3 `0 T- Y) {0 A$ j. \) \
Disk /dev/hda: 4294 MB, 4294967296 bytes
* e- C& r: u, {2 N% X+ X8 x& j! \ 16 heads, 63 sectors/track, 8322 cylinders
6 R! c5 L, c% z, ? Units = cylinders of 1008 * 512 = 516096 bytes
1 v3 N) y# K0 k+ N Device Boot Start End Blocks Id System
* c/ x9 T1 ]4 ^! M Command (m for help): m
! F3 g# f- |) l Command action
9 ?5 B- K$ p/ n6 T5 h a toggle a bootable flag( y0 N7 O& u, e- q
b edit bsd disklabel! r- K; n* ~$ t, A
c toggle the dos compatibility flag
) T/ Z6 B( E" P" t! O* R d delete a partition3 [1 ^9 w' B$ ^0 Z5 ]5 ` b/ V
l list known partition types
8 j. q8 C% e2 ? E% [ m print this menu
" _4 q1 W! j2 Q* X2 H6 T n add a new partition% m- O/ X+ f/ l. b/ I& g
o create a new empty DOS partition table1 C' G: P8 v6 y# H
p print the partition table
8 x* Y" ?, h" w3 l6 b) ^/ n q quit without saving changes
: o$ O. ?2 U2 w$ s s create a new empty Sun disklabel
1 C# C6 y/ m6 G0 ^ t change a partition's system id
7 @9 X! U) [# n( e u change display/entry units
) |$ ^ j$ q% G: n v verify the partition table
. j6 r2 B# G$ l k w write table to disk and exit+ u+ V. A" S0 P/ F
x extra functionality (experts only)0 t3 k! ~7 C% }- S* T$ l
Command (m for help): n3 n i6 j/ P1 J6 o
Command action/ a$ s, B; ?2 m2 @3 r# {
e extended
, C$ F; N. o) a' P p primary partition (1-4)4 ?; E, T4 o- ^1 m- ?" P# D
p
& ]0 L/ W/ v' M$ |2 ` Partition number (1-4): 16 {! i3 w3 m7 @, B( V3 R) q; t
First cylinder (1-8322, default 1):
" S0 W4 V9 w9 \9 Q9 E! M Using default value 1
* E$ D* h0 P8 T Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
2 H% p, e v% e# v+ ` Command (m for help): p
) H' u( f# j3 z$ E6 U) K# l Disk /dev/hda: 4294 MB, 4294967296 bytes
7 Y0 N R8 }+ |/ F! w 16 heads, 63 sectors/track, 8322 cylinders
/ Y0 q$ K% W) d: k% F2 \3 A Units = cylinders of 1008 * 512 = 516096 bytes( a# Q6 p; A2 \2 \: q! j+ s9 M
Device Boot Start End Blocks Id System
, a4 n, u( r9 n B* N; c /dev/hda1 1 1000 503968+ 83 Linux
0 \0 G; X* F& M W7 x' U% [ Command (m for help): w7 P5 R0 ?, x% o, e/ k' Y
The partition table has been altered!% s8 }. C% P& y- K5 x5 S+ ?
Calling ioctl() to re-read partition table.0 o; n% O$ R! a" H; N# U, k0 m
Syncing disks.- Q6 \( l4 A+ j( V O7 R2 g1 Q
//格式化新分区' P2 U9 w* E. l& r
mke2fs 1.32 (09-Nov-2002)
1 t9 u7 o n1 Y0 _ Filesystem label=5 [+ K* l7 I; i6 q: B! z
OS type: Linux6 u: x+ l% B5 I# P* a% _
Block size=1024 (log=0)
' t7 O, p! a6 S& k) {; ~8 { Fragment size=1024 (log=0)# c* A/ _) ] i. S3 E) l
126480 inodes, 503968 blocks. P9 K; b |( }
25198 blocks (5.00%) reserved for the super user% B/ o: t6 ^- o2 Y' c( z
First data block=1) z; K0 _/ g/ O" _. I
62 block groups
# z* X6 s9 U- }- U! N) c5 l 8192 blocks per group, 8192 fragments per group
# d, n+ B4 `8 o0 d% b" o 2040 inodes per group- k- P) q9 c& j) ]3 r
Superblock backups stored on blocks:
3 z8 w+ m6 c5 K& |6 i& R/ Y- e$ c 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409$ h$ Q+ l1 C' d( o- t8 c
Writing inode tables: done
8 A! V/ B0 H; U4 j- w3 E) Z Creating journal (8192 blocks): done
! |$ C% y9 h+ T1 e4 m! ]+ Y0 t Writing superblocks and filesystem accounting information: done& S2 ~3 ?' J6 ?3 I* s
This filesystem will be automatically checked every 30 mounts or/ ?; t8 o1 Y: L' M1 ?5 ~
180 days, whichever comes first. Use tune2fs -c or -i to override.
' G* f% Q+ G+ H+ f a y5 }. ^文件系统 1K-块 已用 可用 已用% 挂载点
( t; ~) l% Z9 o- d$ A1 \9 g S /dev/sda3 3723848 705992 2828692 20% /1 m$ s% b! Y5 a% h: C, r. A% u( q
/dev/sda1 101089 9274 86596 10% /boot
0 B8 a$ U! A D1 J3 L5 g none 14520 0 14520 0% /dev/shm$ `# G4 [2 b( W8 U/ r3 s1 c
//挂上新分区$ }# p" W' |5 n" v7 i
- mount /dev/hda1 /home6 g5 C# L2 m4 C+ a; f% ?# _
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点( v# ` t# D; O8 K: G' |
/dev/sda3 3723848 705992 2828692 20% /+ Z/ J5 G4 |7 y1 v Q' |
/dev/sda1 101089 9274 86596 10% /boot; m6 m6 b' k. L1 Y+ b* f2 G' \
none 14520 0 14520 0% /dev/shm$ X$ K' z6 C, G9 u
/dev/hda1 488006 8239 454569 2% /home
7 C5 X/ P* c' i
" R/ n1 s4 T4 z* S& F自动挂载:# f$ r- c+ x- i& C( Q. o
- vi /etc/fstab
5 }" o8 [9 W; E0 t% q; Z5 d: ? - , J5 w- N# k! E. ~& k) P
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0$ I4 b+ P6 ~# O
! l8 d3 T4 T" n- z- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
8 x6 `4 ?% R1 O w$ Y# s- mount /dev/sdb5 /mnt/ljp1: Q0 G) k% W A. s( T7 o% y5 Q$ r
& N! L6 j5 J. d1 @/ n- mount /dev/sdb6 /mnt/ljp2
复制代码
1 c- q, c: J4 m2 W# Q- d
! E, h5 r& E. l4 M) Z o3 l' K2 R# D# Z. I8 {) C5 r
|
|