|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)
( z1 f+ N" V m or: fdisk /dev/sdc (for the third SCSI disk)$ E6 k4 }( U' S6 F, @& J# E2 g/ Z' I
or: fdisk /dev/eda (for the first PS/2 ESDI drive)" @" C X; Q- v" \5 x
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices); T$ d' _- ~7 [6 {4 w% k `
...
: X& B) x0 M/ c/ `- df -k
, c& k0 y, n f; C: | - df -lh/ Y$ B% l) T7 H5 W% l) A
- 查看有几块硬盘:fdisk -l: \' t v6 \, e4 z
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点2 T: b* i/ T; B( f
/dev/sda3 3723848 705968 2828716 20% /4 N+ o7 w0 ]1 W$ k0 i, a2 R
/dev/sda1 101089 9274 86596 10% /boot3 U8 j" B& s+ Z' L3 D
none 14520 0 14520 0% /dev/shm
7 p' t" ?7 F) y: }( D5 j& Y 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
4 `. j# b( Q2 Q, E) M9 JDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
; i% h9 f q( d Building a new DOS disklabel. Changes will remain in memory only,
9 Y; I( V. U' _ l- m: U until you decide to write them. After that, of course, the previous
# Z$ S1 Q. y) w; X: k5 Q content won't be recoverable.0 C ~: ]; ^! [$ G
The number of cylinders for this disk is set to 8322.
3 ]6 m' X: o! s. z There is nothing wrong with that, but this is larger than 1024,
& z- s$ B, j! T+ {" T and could in certain setups cause problems with:3 O0 }* B- P7 C5 n4 T5 `
1) software that runs at boot time (e.g., old versions of LILO)" j: Z$ g6 l+ E8 w4 O# N: i
2) booting and partitioning software from other OSs
! N+ \- S! `" C" A3 l% P9 h (e.g., DOS FDISK, OS/2 FDISK): c6 ]; j- u: Z8 ]
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
$ N5 X4 }8 \4 T Command (m for help): p
3 |3 B2 e8 V) F! a% m Disk /dev/hda: 4294 MB, 4294967296 bytes: Y7 H. I. H2 w. @# ]2 t
16 heads, 63 sectors/track, 8322 cylinders
5 h0 _3 M9 k: P0 e Units = cylinders of 1008 * 512 = 516096 bytes F( k1 B+ x# I1 B9 f/ M
Device Boot Start End Blocks Id System q& {7 |6 @ h
Command (m for help): m1 [7 K; [$ H1 `
Command action
- k$ e2 y, W l' a a toggle a bootable flag
% I" r- C+ y! F3 ?, F* e& ]: F b edit bsd disklabel, q$ T) ?1 v; O3 C: v! W! X( }
c toggle the dos compatibility flag- d- c) @+ \' ?( P1 \$ E
d delete a partition
0 U3 ^8 G6 V, C: k' j l list known partition types' G! X5 z0 w6 g
m print this menu
/ a5 g) j& r$ G( m( I( i) M n add a new partition9 }6 p7 o4 ^! J% g f- g
o create a new empty DOS partition table+ ]$ z8 b% y# D F$ x+ V
p print the partition table& {5 r. r" A+ u1 P! u( F
q quit without saving changes* W* T& V5 e9 o
s create a new empty Sun disklabel
! f% k( h j3 w( S) u" V t change a partition's system id. n) j1 q. s3 g
u change display/entry units/ Q- a4 l/ s) [9 K
v verify the partition table
) i* f/ n b5 ]4 q, _ w write table to disk and exit
/ {; t" ]1 S2 H* } x extra functionality (experts only)1 |' c, \& P" y, y2 C
Command (m for help): n
! B' a) w$ T/ N& ^6 c6 Q Command action! Q; T% h. Z% ~0 u( W9 b
e extended- E M( w9 z) x; U
p primary partition (1-4)
8 ]+ z% m" ?, f: w" |6 G( b7 T p4 ]5 v( n6 i$ y5 n
Partition number (1-4): 1
! a4 {, `3 ] \+ o First cylinder (1-8322, default 1):
, z* w7 b! ]$ R/ | Using default value 1
* |( A. `: n) v+ X Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
. ~% f0 L6 P0 X5 B+ ^6 y% s0 H% c. w8 K Command (m for help): p
4 m N) Z s8 {4 W Disk /dev/hda: 4294 MB, 4294967296 bytes6 _0 z, V. S8 l; D
16 heads, 63 sectors/track, 8322 cylinders3 v/ H' E" N' ^# I% |$ D4 s) V3 S
Units = cylinders of 1008 * 512 = 516096 bytes
5 v0 A4 H. @ \* f Device Boot Start End Blocks Id System
' B# |7 V* j; a- Y /dev/hda1 1 1000 503968+ 83 Linux
4 |# B1 R: ]0 v8 }6 [1 ~ Command (m for help): w
; D$ ^# W Q# d( X5 \ The partition table has been altered!
8 S+ t8 @, m9 I% U& D+ C7 G! G Calling ioctl() to re-read partition table.0 @8 `3 m9 Q8 e- |& I
Syncing disks.! ^' Z9 ^/ @. p# S& B* U
//格式化新分区
' C8 |# W1 s* M2 tmke2fs 1.32 (09-Nov-2002)
& L$ W8 x7 c0 C Filesystem label=
% S+ V% R6 F* Y% j OS type: Linux
7 z' f3 Y! k& r9 X+ \9 {& v Block size=1024 (log=0)
5 ?! a5 k% |# U% p, p" j' S$ {" _2 K Fragment size=1024 (log=0)
5 _8 G9 H' o" V. [8 F 126480 inodes, 503968 blocks3 z/ }: Z) Z8 F& i
25198 blocks (5.00%) reserved for the super user
: B" z8 \0 y' J/ T First data block=1$ q' I7 I8 D7 ~; u) n3 S# D# s
62 block groups
* c4 K) m& c& h 8192 blocks per group, 8192 fragments per group
; A- j& X. h! l! h. l- T4 z 2040 inodes per group
' a3 s4 w9 m; |4 U! K$ { Superblock backups stored on blocks: * }! w: f& r$ Z
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
% |& U7 r* i5 j6 b9 b* a0 p% g Writing inode tables: done / G9 O1 N3 @* b* k4 r
Creating journal (8192 blocks): done
6 t; m9 `" i/ y4 ?+ T& x c! J) m \# { Writing superblocks and filesystem accounting information: done
3 W& h) M6 j- m6 @: k This filesystem will be automatically checked every 30 mounts or
2 |2 n9 |: z3 u" s3 g5 Z 180 days, whichever comes first. Use tune2fs -c or -i to override.+ n1 q4 D$ y3 u" T1 g4 g( O
文件系统 1K-块 已用 可用 已用% 挂载点
1 c- B7 {9 y4 b! j" F4 R* D( k /dev/sda3 3723848 705992 2828692 20% /
* }1 n/ _5 b$ \, D /dev/sda1 101089 9274 86596 10% /boot
1 u, ? {2 O F( p% M/ w none 14520 0 14520 0% /dev/shm
+ p3 ?5 U2 S5 R2 f; n* I3 y. [ //挂上新分区
1 M5 y, a5 t% |' K9 c6 O5 T- J- mount /dev/hda1 /home" q3 ^2 [7 e& F) e: s2 z
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点8 j+ \9 N" j5 ?/ u* O0 X9 q6 x1 N
/dev/sda3 3723848 705992 2828692 20% /
* l2 r; R/ l( H/ z /dev/sda1 101089 9274 86596 10% /boot
, y8 J+ k! d, N none 14520 0 14520 0% /dev/shm( k7 t9 ^: k* `
/dev/hda1 488006 8239 454569 2% /home2 ]! k& J* {: k2 Y
6 s4 O/ A1 K9 O& Z+ O自动挂载:
% }6 _" I7 `( I3 s$ \: G8 P- vi /etc/fstab* S& k& v( n9 }) |8 Z" N% _. F
% ^! ]9 m3 P; U; ^6 g- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0( B- K. d( F/ e7 M0 Z- {7 L
3 v) ~7 ~0 ~- i8 H- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:8 ~# e- `" o$ z! p
- mount /dev/sdb5 /mnt/ljp1
2 C( W& m0 ]; R" ~; p9 C3 q
/ d. f# r$ S3 ?2 F" M/ [3 O- mount /dev/sdb6 /mnt/ljp2
复制代码
8 X8 V' L- ^/ T- J3 ~6 W: A8 {4 U+ Q* O @
6 q& g z6 W: ] |
|