|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)8 R& e+ r0 h! i3 d" n# Q* F6 h
or: fdisk /dev/sdc (for the third SCSI disk)# `' P2 P9 C7 a1 `1 W
or: fdisk /dev/eda (for the first PS/2 ESDI drive)
) A7 `$ k( a) `: ^/ j% U or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)- V: y! o. `. ?/ E6 _- C u. A
...
# z7 r% G4 @2 g( ]* s7 x- df -k
# j: `4 y* N% [ - df -lh' b$ G; Z+ `( }% O6 H# l1 W& Q. b
- 查看有几块硬盘:fdisk -l" N# T/ n |5 P! U4 f/ Z
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点1 T! B( A( b6 O
/dev/sda3 3723848 705968 2828716 20% /
" V, i- c! b4 J$ S! K, y /dev/sda1 101089 9274 86596 10% /boot3 p8 g, p- p* {8 M
none 14520 0 14520 0% /dev/shm
9 e/ [( i( z" c$ L. E% N 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
* s) X0 k% }: FDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
0 c6 P6 O, l3 p" E4 [0 a) H- [ Building a new DOS disklabel. Changes will remain in memory only,! S( c% {& R" m+ Y- k
until you decide to write them. After that, of course, the previous2 n F( _/ t6 f% I
content won't be recoverable.
( o! x/ R' t L A6 c; _ The number of cylinders for this disk is set to 8322.
: G" b$ k& B; N: u' ]! a w. ^" d There is nothing wrong with that, but this is larger than 1024,! R9 f+ I5 n |9 \' x4 ]0 B B
and could in certain setups cause problems with:
* ^9 w' z: Q3 ^ 1) software that runs at boot time (e.g., old versions of LILO)
" V# A% x: G9 O. H! S0 s 2) booting and partitioning software from other OSs% D+ `9 d" x! Z: a! p# r& a
(e.g., DOS FDISK, OS/2 FDISK)
) f2 e/ q# P: [1 p; F b Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
$ G0 o: E u S" o' P g Command (m for help): p
$ G. E3 I: I P- L0 m, Q Disk /dev/hda: 4294 MB, 4294967296 bytes' H- @! M1 |8 l* ]
16 heads, 63 sectors/track, 8322 cylinders, j) o: Z0 h. H
Units = cylinders of 1008 * 512 = 516096 bytes' c# i% D ^! s: K. j
Device Boot Start End Blocks Id System+ P: D1 J o) y
Command (m for help): m4 I" `1 Z8 l. {2 b: V9 ~4 C8 f
Command action
j4 Y3 S9 m. |2 Y8 k4 ]8 t) T( ^8 X1 `5 T a toggle a bootable flag
- @6 W" s( B0 C& D/ g b edit bsd disklabel1 ~ V# e7 M5 }: f1 f3 I
c toggle the dos compatibility flag
+ r$ k2 S" U9 P) |! {# C d delete a partition3 B5 x+ V3 V. @* j2 B' T" o
l list known partition types
# ^8 M9 I) V- F m print this menu
+ N" j1 _8 R; d. T5 z% \9 K! U n add a new partition
0 u1 G {" w) r" ? o create a new empty DOS partition table
( y, b% M2 m% L/ G) h4 ? p print the partition table& u3 u2 I: r$ E `
q quit without saving changes7 a5 a/ ?: N* X) a5 H$ B
s create a new empty Sun disklabel
. M" H% j- X3 V5 P% r1 }- l t change a partition's system id- I! b, n, J0 [! ], r3 G d$ L
u change display/entry units% N7 y/ B/ z( q' x T
v verify the partition table U" @: A6 \# \& c8 s
w write table to disk and exit
- d9 {( i4 O/ O" n' x; F x extra functionality (experts only)
: B5 o3 o: z( ]$ L$ J. w( v Command (m for help): n# A/ e, |+ ~. o( a
Command action
% I3 h9 ]+ {$ x# Z1 t$ c5 p e extended
% v% s% F1 k3 M8 V: J) m1 g p primary partition (1-4)5 I9 \* U+ W( n" H. G5 T
p+ X: }6 R/ o& v+ m+ E6 ~
Partition number (1-4): 1
. y- y ~2 I+ B5 E. u% w# z First cylinder (1-8322, default 1):
& F9 ]/ `8 N$ m( W- d. G Using default value 1+ ^& x3 s0 f" b' h/ D
Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
: l+ [7 R" g4 T Command (m for help): p" L; `' F7 c# l: j
Disk /dev/hda: 4294 MB, 4294967296 bytes
0 X! t" R% T7 b) g; B/ J 16 heads, 63 sectors/track, 8322 cylinders
& P/ T( F6 s* X/ s8 a Units = cylinders of 1008 * 512 = 516096 bytes% P% o% f; K( W( w# B$ {" a$ l* O
Device Boot Start End Blocks Id System
2 V- i, ]. |; V7 l /dev/hda1 1 1000 503968+ 83 Linux
4 R/ R' b# I8 @, s1 b/ U8 X Command (m for help): w
7 k$ p+ Q' K+ Q7 H; ^ The partition table has been altered!
: a, |, A8 f( A/ ]1 Y Calling ioctl() to re-read partition table.
8 _7 A: F: C1 g# F& R6 H9 E! } Syncing disks.( r% [, M5 T0 q2 P6 N2 Q
//格式化新分区
+ }: U5 o! O: |* }8 a Lmke2fs 1.32 (09-Nov-2002)$ g3 R4 P$ j8 b& R0 ^) r3 T
Filesystem label=
5 ~0 L3 I9 f7 Y OS type: Linux3 ^. P" R& x) F! ~
Block size=1024 (log=0)
! Z6 `( ?/ t- E. |# ~* b% V3 H Fragment size=1024 (log=0)
2 g# G: G: p" O4 ^4 z% Y& U' x 126480 inodes, 503968 blocks
; Z2 k/ t9 q. c1 v5 C7 G( p 25198 blocks (5.00%) reserved for the super user& f8 X2 x0 d9 Z, l
First data block=1
I& X& E% K* q6 B7 Q7 ? 62 block groups3 X' a/ A( d/ x s" l8 p
8192 blocks per group, 8192 fragments per group6 U1 l' I2 Z: a% C4 d
2040 inodes per group# h6 \5 P+ w6 k0 F+ C* P+ j
Superblock backups stored on blocks:
/ g3 z- v, b# G. J2 g' _ 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
: d; a1 U( w0 y r2 K8 v8 J n% M( ^ Writing inode tables: done 2 Y+ e7 z( o/ I1 q
Creating journal (8192 blocks): done h4 D: Z H4 d6 H7 [1 @5 z
Writing superblocks and filesystem accounting information: done' c) w0 w/ I! |. E0 [- a
This filesystem will be automatically checked every 30 mounts or
* _* `( R$ J1 i* j 180 days, whichever comes first. Use tune2fs -c or -i to override.4 m& s, b& |7 ^* M* S) Y' G; M5 H0 u! Q
文件系统 1K-块 已用 可用 已用% 挂载点
9 J/ I- L% \( s Y/ G: O. k1 }7 P /dev/sda3 3723848 705992 2828692 20% /
! S( ~9 v: |! a Z; A /dev/sda1 101089 9274 86596 10% /boot
' W) G; f5 ]1 Q. M* A$ n none 14520 0 14520 0% /dev/shm$ I- C/ z4 }. z. w- z
//挂上新分区
8 h9 W0 Y# a7 |/ |- mount /dev/hda1 /home; {$ F0 e; U/ K6 N; Y
- df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
* T6 _2 S* y) K! v. \* S /dev/sda3 3723848 705992 2828692 20% /! Y3 x w5 X6 V! A+ @
/dev/sda1 101089 9274 86596 10% /boot r# Q) P" `8 X+ [ V* ?/ U$ l) d
none 14520 0 14520 0% /dev/shm
5 e) T, z9 w& m; t* F0 R /dev/hda1 488006 8239 454569 2% /home
4 h$ B5 q7 B$ H3 Z5 Y* ~+ Y+ w, m' P$ W2 [+ r
自动挂载:
- H3 X5 a/ `& u' Y- g {# q5 M- O- vi /etc/fstab
0 o' j6 V3 |* q. |% O
8 z" C( ~3 z% o* y5 \5 O6 U- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0
. c9 k5 Z* D v! r3 o: ^- A( ^ - & c1 c, [1 C! T5 [0 L* n4 u1 @
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
( }8 i0 d- X3 e# e0 C& X3 |: M* j- mount /dev/sdb5 /mnt/ljp1
( Z" a9 P6 `& X! ` - ( c6 J8 @1 A [& I
- mount /dev/sdb6 /mnt/ljp2
复制代码 + g. @' W2 K$ y' ~
3 T6 H: A# W) w* ]6 t9 n# W) Z$ Q4 n9 z2 S* \1 f& n' W! b
|
|