|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk): h) c, ?& f! g0 ~2 P
or: fdisk /dev/sdc (for the third SCSI disk)# x$ o2 ?$ Q; U) Z( d
or: fdisk /dev/eda (for the first PS/2 ESDI drive)- J) ~: a8 o6 _3 t
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
I; T/ Y) R+ W/ C$ X ...& K, C: v+ G& S' H5 J
- df -k
4 P# q4 H) b' B9 u. X: K' S - df -lh2 F3 }8 Y; K8 Z( x' c, Q
- 查看有几块硬盘:fdisk -l. K; y: ^, u' T; C
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
2 s1 d) V, M! c7 f /dev/sda3 3723848 705968 2828716 20% /
- \) F) x. I/ l( M/ \0 j J /dev/sda1 101089 9274 86596 10% /boot4 t% N% z2 x0 u# b" U
none 14520 0 14520 0% /dev/shm n. j% t; F, f: @, l5 U( B' W
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
, k% u+ K+ G7 u" ~) }0 t$ W1 ?Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel0 k& ^" A6 {7 \2 S j. H
Building a new DOS disklabel. Changes will remain in memory only,
* U( G- O, j' \" J1 f until you decide to write them. After that, of course, the previous* D$ W, Z# ?9 y$ B* N0 R
content won't be recoverable.
1 N0 _4 g j+ t: ^! p The number of cylinders for this disk is set to 8322.
4 F3 V! t$ R8 q There is nothing wrong with that, but this is larger than 1024,
P% ?; L( V9 ?8 n+ X6 [ and could in certain setups cause problems with:, C' A/ r( J3 Z1 x+ |
1) software that runs at boot time (e.g., old versions of LILO)
- g! M: W* ]2 Z, o! N 2) booting and partitioning software from other OSs
" V D$ Q- l5 v: [% X5 }- F' o (e.g., DOS FDISK, OS/2 FDISK): r) W7 p& P# c+ F, P
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
4 K6 D; w* p0 d' m8 T Command (m for help): p: |0 r7 q) c" p! V# V: d& b
Disk /dev/hda: 4294 MB, 4294967296 bytes
6 d7 l, A# H& T3 w# k 16 heads, 63 sectors/track, 8322 cylinders
9 \% x7 k5 f" _4 T Units = cylinders of 1008 * 512 = 516096 bytes6 V8 Z/ e0 `/ ?
Device Boot Start End Blocks Id System; d" f% Z0 r$ {2 l
Command (m for help): m6 P% h: }0 N; b; V- ~
Command action
* C$ @5 h$ p4 ^3 a a toggle a bootable flag9 d; G. i# F% N, T2 u1 I
b edit bsd disklabel9 E$ z) _( o4 C
c toggle the dos compatibility flag
6 m9 K2 f. q1 G$ S; M d delete a partition6 e( t$ i8 R5 h) H; f
l list known partition types
' W% c, @0 C% l0 X; x4 M( j m print this menu+ [ |: T( J; k }: a
n add a new partition
8 B- ?3 j0 T# ` o create a new empty DOS partition table
% \) Q- |$ }* Y) c; p0 t p print the partition table9 d" f8 ]2 t; ]% [, V. R
q quit without saving changes
" `& j4 J7 {) [& t: C3 Y' F" y s create a new empty Sun disklabel8 k/ S& C. S @7 A7 A9 L9 G+ |
t change a partition's system id
6 i2 m P+ R' F& \& { u change display/entry units
" x& S( C4 r" m5 M5 J" Z% Q v verify the partition table
7 A6 w- ^* O" R) K1 G) y! d2 B w write table to disk and exit
( g2 j( ^9 n+ E x extra functionality (experts only)
; w2 g$ J: |3 H Command (m for help): n) d( w$ W' X( ^5 A1 L4 L( f
Command action+ ?1 S7 {, B- _/ F8 z5 L8 p
e extended
$ t( B/ t U+ i p primary partition (1-4)
: I& p/ P7 |. J% A- p/ c p E3 {& m! N3 j% t( a5 v0 c
Partition number (1-4): 1 d- D& X- x: F
First cylinder (1-8322, default 1):
1 P5 E+ u3 G9 F _' f$ f Using default value 1
- V' d: _4 ]; o5 Y; d7 [ Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G9 \$ T$ \5 I- @9 n( m! B
Command (m for help): p
4 z, f/ i) o; P: X( n5 h Disk /dev/hda: 4294 MB, 4294967296 bytes
9 c8 G& o% T" t. S+ L 16 heads, 63 sectors/track, 8322 cylinders
0 C, [2 _. M( }' G+ _. M Units = cylinders of 1008 * 512 = 516096 bytes
6 R! w, I: Q" K+ o1 I) o; ]' \- y Device Boot Start End Blocks Id System
% |, @$ u" e1 \/ C# a7 ?5 _& c /dev/hda1 1 1000 503968+ 83 Linux
& Q3 G2 e* s7 f$ u0 y Command (m for help): w; C1 [" ?, ~' l4 z+ Q
The partition table has been altered!
6 F& n. L. y) q- \# \$ m Calling ioctl() to re-read partition table.
8 ~( P" m* _8 a# ?4 E Syncing disks.
3 _1 A5 G6 U& U1 P F //格式化新分区
% g: R9 w: Q1 G1 xmke2fs 1.32 (09-Nov-2002)
6 o1 z# l6 Q" K _% ^% } Filesystem label=9 y* `- C) |% D3 ~! H2 U
OS type: Linux I- n6 G. X% s, n2 I9 R5 I9 q
Block size=1024 (log=0)* {/ f" ^$ Z# r* J5 h
Fragment size=1024 (log=0)
9 R. L; {, ^. H 126480 inodes, 503968 blocks2 [/ E3 A: ?( C; V7 r1 Y% @
25198 blocks (5.00%) reserved for the super user
8 p3 y+ {' Y1 x& Y# S, A5 O8 T First data block=13 C) S7 r9 f6 d6 ?4 b
62 block groups
2 l5 {1 L) l2 Y 8192 blocks per group, 8192 fragments per group9 u) Z7 m2 M( l$ ]$ v1 i+ ^! U. ]
2040 inodes per group
, [$ [' f& |- e6 f# V Superblock backups stored on blocks: 7 h- H1 T4 ~ ~$ ?1 {9 N- J
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
. y& c( b( i2 M5 a. `0 q& x6 P Writing inode tables: done
( P, o* j* M% z" Q3 r3 q: F Creating journal (8192 blocks): done0 K- j! O# |3 W. H9 y
Writing superblocks and filesystem accounting information: done' C+ K% ^% x% L% n7 D. }
This filesystem will be automatically checked every 30 mounts or
$ `2 V* e8 L& T. d; c' _ 180 days, whichever comes first. Use tune2fs -c or -i to override.8 x+ |# c& T4 R
文件系统 1K-块 已用 可用 已用% 挂载点
! A: W( `0 k0 B. J9 e /dev/sda3 3723848 705992 2828692 20% /
5 B# m1 B$ f5 j; f /dev/sda1 101089 9274 86596 10% /boot8 n8 Y- h% X! o! x# ~6 }9 L; ]" B
none 14520 0 14520 0% /dev/shm
1 Z$ W' s8 v9 L6 G7 b4 s //挂上新分区
: x1 d8 @. T8 Z/ S7 C$ \- mount /dev/hda1 /home0 u; ^2 o: D- s
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
5 A- ^- [5 C2 |& k8 q/ f /dev/sda3 3723848 705992 2828692 20% /
- [. f8 B: J8 Y: x /dev/sda1 101089 9274 86596 10% /boot
) n& @$ a1 Y2 m ? none 14520 0 14520 0% /dev/shm
_- G0 z5 ]- Q+ V. | R /dev/hda1 488006 8239 454569 2% /home
- V& O0 P. H6 R4 U. K
1 E5 x* C! z; Y/ u# d5 E" {- v& U自动挂载:" [ J$ f6 A; F3 i# o
- vi /etc/fstab& `5 l0 j+ }% F3 J2 D4 S
- 0 U: d$ O/ x' z" s
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
! n0 B" b9 a6 b) q( x% j! a7 v - 0 b" E( |) {) {. s7 |
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
! G" e) q* r" e- E$ P5 j& e- mount /dev/sdb5 /mnt/ljp12 f- P7 O- Q8 K# O1 ]5 g
. L `' b% U9 Q5 o+ I2 Q8 l- mount /dev/sdb6 /mnt/ljp2
复制代码
; R& h- E7 M5 D# h4 A
" J6 |0 x: D# m! M% ]% \/ {. t' \$ [1 I8 `$ ^& |: h( r* i
|
|