|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk); E, [7 ^" L. b U$ o+ F. b8 ?
or: fdisk /dev/sdc (for the third SCSI disk)
7 d) J7 N! w6 d. _" ] ^8 r6 g or: fdisk /dev/eda (for the first PS/2 ESDI drive)
' b6 |* u3 B3 L f* H. F* m4 q or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)
3 p9 ^+ R+ p7 ]: o; k% C: x5 N& _ .../ U; a/ @' X; [% d/ p6 M. b8 y
- df -k
. h( D$ i7 F" W" {, ^- _, ` - df -lh- J! i# p; u( j5 ~3 J6 ]' O$ m
- 查看有几块硬盘:fdisk -l
! p: _6 n% H: c9 H
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
! D2 r! {# W! d+ Y2 I% K1 C. Y2 {( B w /dev/sda3 3723848 705968 2828716 20% /
# M, D8 x b3 E6 f2 {' w1 @ /dev/sda1 101089 9274 86596 10% /boot& S7 Q2 l" {. l5 ]! G1 l0 E
none 14520 0 14520 0% /dev/shm# W" @$ y$ u0 v' v! \1 u
对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
" b3 ]2 C( j$ c5 zDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel a9 F! \6 w# \" f2 v
Building a new DOS disklabel. Changes will remain in memory only,
- l k% f! q& x# w+ d# T( v until you decide to write them. After that, of course, the previous
$ P; {1 m# D; v content won't be recoverable.
8 S. u# C& m: e' q The number of cylinders for this disk is set to 8322. F1 S+ a$ ]' M* N( t0 M
There is nothing wrong with that, but this is larger than 1024,
9 q. ~# p" o5 }9 m- D. k and could in certain setups cause problems with:
1 z% f/ N2 }/ P F/ g$ i 1) software that runs at boot time (e.g., old versions of LILO)6 {' I' v+ n d
2) booting and partitioning software from other OSs8 r$ h/ o- |6 W+ c3 ?3 \8 F1 z
(e.g., DOS FDISK, OS/2 FDISK)
, j8 e& ]/ H: s/ k Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
7 J% T4 H( t3 B1 E Command (m for help): p* e' n6 g9 l4 ]3 H# q
Disk /dev/hda: 4294 MB, 4294967296 bytes
, m; W5 L6 e' Z8 c; ^+ c& F! Z8 y 16 heads, 63 sectors/track, 8322 cylinders
* k, ]* }5 U1 K7 b2 j Units = cylinders of 1008 * 512 = 516096 bytes% Z3 K, e4 Y+ M, j F6 K* X: {5 d
Device Boot Start End Blocks Id System+ E" S9 v3 m5 [
Command (m for help): m
* M4 o, K* A1 o; L4 ?, g Command action
( B4 C$ L, D3 A s! A5 |, l a toggle a bootable flag
& O& l+ }6 M) X/ E; H( p0 q% o b edit bsd disklabel/ g7 ?# k/ S( E9 D' G
c toggle the dos compatibility flag
) R* l* x( S) \* ~/ _ d delete a partition. V! c" ?) W. j4 Q. W
l list known partition types0 k$ V/ u* D1 h! W# x" k0 f2 {
m print this menu
( ^$ f1 _- [+ v4 K n add a new partition
8 @( M" Z' V) b$ ~/ l o create a new empty DOS partition table* v7 Q4 ]1 A" N4 U, G' u6 x
p print the partition table1 P- {5 W( r% k2 z- K
q quit without saving changes
# R' i& `5 K2 ? s create a new empty Sun disklabel
, R! `3 l C. c2 a4 P2 G7 [- g t change a partition's system id' w; U3 ?. s7 t8 I9 M; {
u change display/entry units; }3 o- l- I2 L# K+ b
v verify the partition table
( D. K# L1 V% D3 M. O; l* a% Q( K$ _ w write table to disk and exit
# S+ U) ]& r" w! b) j6 R x extra functionality (experts only)) p+ c* \! x% O6 E1 v$ n/ @
Command (m for help): n; K2 ]$ ?8 p4 d2 X- U' K9 W
Command action
$ b$ W8 F9 j* k A- [ e extended
. Z6 s6 y& A: M; v. v" @# j p primary partition (1-4)
7 f0 M. m9 o. C+ I: o- p4 E p |% f) e, x! u# I/ A
Partition number (1-4): 1
) b+ x& M) H. t1 I3 J First cylinder (1-8322, default 1):
2 Q4 w9 ]! ^; c, Z+ p8 L, i Using default value 1' a+ Z' S# U/ g- D
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
6 J7 ^+ E- @2 \! V6 u* B Command (m for help): p
* ~) i* s& Y8 K M Disk /dev/hda: 4294 MB, 4294967296 bytes
8 p6 s6 q0 j- H2 f 16 heads, 63 sectors/track, 8322 cylinders- e7 ~4 t2 N* @) |
Units = cylinders of 1008 * 512 = 516096 bytes; @# i/ ?4 N% J# S( e* y. }7 \' Z
Device Boot Start End Blocks Id System
; S; `8 `% ?/ g" B- g6 o /dev/hda1 1 1000 503968+ 83 Linux
" w" t3 |5 A" T. m Command (m for help): w' f& V- z9 v7 R, h& }) {* P
The partition table has been altered! |0 l0 b9 L+ g9 f& a% c
Calling ioctl() to re-read partition table.
Z; k* @$ O" V8 i' `3 t) M& | Syncing disks.
& E0 j& Q; A4 c+ X1 s2 M. z //格式化新分区7 g6 R0 w8 G: Q7 R" U- T
mke2fs 1.32 (09-Nov-2002)4 V/ g& ?( s8 b/ n. t6 o4 r
Filesystem label=
: o& ~. j! c0 R# H( V OS type: Linux' o. q1 }7 M9 Z. D
Block size=1024 (log=0)& Q$ @0 P8 m0 k6 D# F$ Y; W
Fragment size=1024 (log=0)+ M+ v4 F0 w! C, t. M
126480 inodes, 503968 blocks$ N% w" s( M! R2 }* h6 ?0 L4 s
25198 blocks (5.00%) reserved for the super user/ J) v2 `0 v. Z7 z/ ^7 G3 S& }) M1 _! G
First data block=1
2 A3 O, S9 K' M* f 62 block groups6 }3 n q# O: X) ]; t# U4 L
8192 blocks per group, 8192 fragments per group/ q$ T2 f/ {5 h/ t( a$ r
2040 inodes per group
5 y$ Q( Z; o9 W# k+ L2 E5 L& d Superblock backups stored on blocks: 9 m: C. M0 M t; ^, R' p8 ^
8193, 24577, 40961, 57345, 73729, 204801, 221185, 4014090 A0 ^. q! n) a/ ^
Writing inode tables: done
: z/ I1 w0 w. h0 E! p+ t Creating journal (8192 blocks): done
* v* K; ?7 W# {+ E7 v; q" B+ S: J Writing superblocks and filesystem accounting information: done/ q6 w, Y9 j1 Y, J# g) i
This filesystem will be automatically checked every 30 mounts or% G" L- M& H! {$ p
180 days, whichever comes first. Use tune2fs -c or -i to override.4 F, Y- k+ m/ z# e
文件系统 1K-块 已用 可用 已用% 挂载点
+ w- O/ r9 v* B% A) P; ? /dev/sda3 3723848 705992 2828692 20% /
5 s. G( h4 ?) v+ b4 Z6 U4 g4 D' | /dev/sda1 101089 9274 86596 10% /boot
% V9 |1 ?' o/ n7 [ none 14520 0 14520 0% /dev/shm L. l* I- b% g
//挂上新分区2 Z7 ]; F" d0 ~& L% f
- mount /dev/hda1 /home
! L0 Y% T6 D3 x7 g' ]. A0 | - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点( c& R, B% W3 L$ Z$ T
/dev/sda3 3723848 705992 2828692 20% /1 d' J0 U5 y* ~! L
/dev/sda1 101089 9274 86596 10% /boot
1 R3 t1 }5 r. j9 g' v! Z none 14520 0 14520 0% /dev/shm
1 |3 h# D5 y: p /dev/hda1 488006 8239 454569 2% /home# M! u: @1 @* g) b; t( b) z7 w
: [% H6 q8 a3 G2 N自动挂载:0 g p7 W( c' ], g
- vi /etc/fstab
8 f$ z# T, t/ N. C - 7 C+ R& y, i0 J7 e. @7 @1 I
- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
9 ^( {' N9 w- a7 N/ U+ t4 \9 R
2 J L* Y" |% O5 o. I+ s7 G- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:* y" m: q) l% E- ~. S
- mount /dev/sdb5 /mnt/ljp1
1 E6 P! t- t/ Z3 d4 {* L l! y - ( N) O& |! j2 ~% f/ v% c
- mount /dev/sdb6 /mnt/ljp2
复制代码
: B0 c- s9 |, h7 i F4 d: R' o; U, K) S9 x1 R
: B! J5 c7 M+ g0 m |
|