|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)) j" o+ O9 H* ^$ q/ `0 G4 I
or: fdisk /dev/sdc (for the third SCSI disk)! j, Y5 s; [8 E) A. P, {
or: fdisk /dev/eda (for the first PS/2 ESDI drive)9 B% M" O# X, F9 H6 Z% a) ?+ \
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices); m) B; W1 v& D
...
/ M. q' M6 T1 F1 o9 Z- df -k
2 [% ^ W& A& \9 F3 v, T/ q+ L - df -lh
" g3 m! |0 i8 K# y - 查看有几块硬盘:fdisk -l
5 [: C/ U4 F3 ?0 J* I: `
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点7 l8 m6 O, n" E3 Q: H! Y
/dev/sda3 3723848 705968 2828716 20% /. t+ q" Z# F; g6 {
/dev/sda1 101089 9274 86596 10% /boot
q9 o0 c! J7 O7 J none 14520 0 14520 0% /dev/shm
Z: v! I/ H& r3 `% D 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用
' O3 r+ c7 D6 ~# Y2 aDevice contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel0 X' E' ^$ u. C
Building a new DOS disklabel. Changes will remain in memory only,2 z7 ^5 g2 \5 @8 R/ z2 x" D
until you decide to write them. After that, of course, the previous% h- \. q+ S5 w; z0 T3 o, O7 F1 z7 W% b
content won't be recoverable.0 y9 w- s* s3 a. U' M* N9 O
The number of cylinders for this disk is set to 8322.9 {2 ~0 I0 B# \5 y
There is nothing wrong with that, but this is larger than 1024,* j1 q$ l5 U( Y
and could in certain setups cause problems with:; L( D- _3 p% J' `; f
1) software that runs at boot time (e.g., old versions of LILO)
6 p3 I5 C3 ?0 O 2) booting and partitioning software from other OSs
/ H+ |& X$ |. \! o4 N (e.g., DOS FDISK, OS/2 FDISK)
* w5 l1 A$ }& ?; N4 F* ?! f Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)' U5 \. n9 n! h9 C
Command (m for help): p
& o. n7 |2 b, m Disk /dev/hda: 4294 MB, 4294967296 bytes1 L. |, b; J9 d9 l+ v: }
16 heads, 63 sectors/track, 8322 cylinders
0 d* i5 g8 l% s* K$ z* Z+ t3 Z( I3 E Units = cylinders of 1008 * 512 = 516096 bytes
. P9 ^3 K _: ] Device Boot Start End Blocks Id System
0 {5 y) T o3 } Command (m for help): m
; o2 Z8 j' @* r+ L9 i7 g& T Command action2 U+ [2 c. Y" n) f. J" X
a toggle a bootable flag: C' v4 [' [' x( m5 o& M
b edit bsd disklabel
7 U( @5 F+ D1 W' j7 W! R. v | c toggle the dos compatibility flag
- e; ?. e7 @) P9 q* f d delete a partition8 R& J7 i# m% N3 k
l list known partition types8 f2 ?0 Y4 \4 j, B- Y. r% z5 v
m print this menu. a8 }6 N2 ?. v' Q0 q- d
n add a new partition
& q3 L; L* m! `6 k& l8 F. J% i, n o create a new empty DOS partition table
8 n9 m; h* i j5 q p print the partition table3 X( i& b* k& H* [
q quit without saving changes
1 c& W; q" O s5 x, L s create a new empty Sun disklabel
% l# x. R) y |; F t change a partition's system id
% ^( O! d0 D* t5 b, J u change display/entry units. z% X' U, `# a- g9 O' Q2 x
v verify the partition table
8 w) a, ]/ h+ p8 Y$ j: k! N6 J, F0 r w write table to disk and exit
$ @3 g! u ?, } x extra functionality (experts only)# I( G* M) W# X5 @, r. T' _
Command (m for help): n. q) u1 j0 e, y2 A) T
Command action5 A2 K9 L2 Z; W" W2 h8 }$ H/ D
e extended: a2 Z4 g" _/ E4 c# m
p primary partition (1-4)3 v- q* \, V% L! o
p
% f1 m r c- {) o Partition number (1-4): 1! O- E3 T! D2 x3 w _9 T& J6 O i
First cylinder (1-8322, default 1): ! v9 c# v% d# M8 m6 ~
Using default value 1
6 @" @( ^ D- A) Z2 X& c Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G1 c. [4 `4 \, B0 {
Command (m for help): p
/ d6 d7 V" I3 n! L! y' n' Y% e; ~ Disk /dev/hda: 4294 MB, 4294967296 bytes
4 V% P! D! I0 i4 r" I 16 heads, 63 sectors/track, 8322 cylinders
* g; ?. p; [5 {5 ?0 {+ Q7 v Units = cylinders of 1008 * 512 = 516096 bytes
( ]4 c8 S# ?1 O! i7 b) p% I7 F Device Boot Start End Blocks Id System
5 a/ J$ Z1 D! v, b /dev/hda1 1 1000 503968+ 83 Linux
5 Y$ `8 F4 U, X) Y+ J% n3 t' _, L2 Q- m Command (m for help): w
# K4 G* e: j4 Q" p The partition table has been altered!7 H. @) H$ B# [+ y3 v m4 h! N/ U
Calling ioctl() to re-read partition table.5 q- t" g3 n1 e/ Q4 \7 p! r
Syncing disks.9 v6 I" J+ x: B3 N# a
//格式化新分区
! o, J# ?- ~3 Y/ Zmke2fs 1.32 (09-Nov-2002)
0 H. C5 q% W- c1 e- E3 J8 n- } Filesystem label=
" @3 x5 c2 A( H$ {; x OS type: Linux
}& j: f; w2 L% \3 P" W Block size=1024 (log=0)
# H9 G3 ~( u T) U: g Fragment size=1024 (log=0)) S; {6 U, w: z4 Z
126480 inodes, 503968 blocks
+ f& ]9 }4 g2 V2 G 25198 blocks (5.00%) reserved for the super user
1 x2 _6 f$ F' j5 b; u First data block=1; z) w! J6 ?8 I% f* Y4 l- L
62 block groups
. H+ O) W/ N5 X( t0 C 8192 blocks per group, 8192 fragments per group/ o! d/ ]6 v$ X0 _4 \
2040 inodes per group
* K: X' J" \ y' S Superblock backups stored on blocks: 9 Z9 L+ U; ~4 A$ ]% f# ~
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
% @: l6 D+ I# b7 Z Writing inode tables: done ) F1 Y1 p* W G) s9 |, K) b
Creating journal (8192 blocks): done z1 s# D% ^7 w3 s' l A
Writing superblocks and filesystem accounting information: done
7 A. ?, f6 @9 o0 m: }4 C* E$ H" a; s+ e This filesystem will be automatically checked every 30 mounts or
- W, ?4 g: o$ z5 V4 U 180 days, whichever comes first. Use tune2fs -c or -i to override.
5 G: ]4 i f; ~- a. Q. L文件系统 1K-块 已用 可用 已用% 挂载点, [# m9 S8 r( G. H4 K3 f9 q- X
/dev/sda3 3723848 705992 2828692 20% /
3 L7 |, Y( ]/ W /dev/sda1 101089 9274 86596 10% /boot
# v. t/ ~6 S' f0 {, h none 14520 0 14520 0% /dev/shm
# L4 X8 J- r- ~9 i //挂上新分区
$ F/ Q: U5 g" h4 n9 _- mount /dev/hda1 /home
* f# Q/ i4 N$ c$ I - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
! \% r# O8 q; ]! B. L7 B /dev/sda3 3723848 705992 2828692 20% /
1 A0 c( T! y5 Q- U /dev/sda1 101089 9274 86596 10% /boot1 G) W1 X/ O3 i9 r# n" k
none 14520 0 14520 0% /dev/shm
8 _' Y4 o, }# z: \0 u# g. r- J /dev/hda1 488006 8239 454569 2% /home
: I$ i, R- Z' Y- s- `
' ^! L; _2 G$ v- r9 r& y$ ~自动挂载:5 U5 t7 i C5 C I( [9 I0 j
- vi /etc/fstab
4 G, @/ ^$ h* {7 N' r5 @8 X& P
" g2 d5 j" V) a( X. I- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0; K4 e4 \" r" u
- Q& F% i1 b6 T! o2 g% c" u& k
- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:, J. Y2 M6 w e, k1 d0 A. r
- mount /dev/sdb5 /mnt/ljp12 g( u: O8 p% C* D
4 G4 i- W V$ n9 Z2 E- mount /dev/sdb6 /mnt/ljp2
复制代码 6 X; o7 G! C2 _: K3 }0 P8 o
" ?- j. s( P9 t2 i4 f8 a' U; O2 a t0 g$ ^
|
|