|
|
Usage: fdisk [-l] [-b SSZ] [-u] device E.g.: fdisk /dev/hda (for the first IDE disk)) i9 |& Q) u9 X
or: fdisk /dev/sdc (for the third SCSI disk)' e2 }5 [$ p1 _; r$ |
or: fdisk /dev/eda (for the first PS/2 ESDI drive)) T# o [+ l! Z4 m& v, J4 r9 l q1 d+ i
or: fdisk /dev/rd/c0d0 or: fdisk /dev/ida/c0d0 (for RAID devices)8 s/ K6 f1 h5 ?! e5 @ Q; W! i
...
6 T& z; B# z; p0 y- df -k
7 ~7 K7 a; Q3 Q; Y4 A - df -lh. C) c, ]% D$ l3 v: T
- 查看有几块硬盘:fdisk -l2 z( _- N: @. u
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点1 R8 N% J( r6 U2 h- H l
/dev/sda3 3723848 705968 2828716 20% /
. x+ X0 G* z1 `% ?" \* x /dev/sda1 101089 9274 86596 10% /boot
2 W: n R% s' Q none 14520 0 14520 0% /dev/shm
; _- A$ |, s+ [ 对新硬盘分区,4G硬盘中划出1G作为新分区。给/home使用) ]) D/ a$ K: v* e
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel+ o2 j. f$ C. C0 K9 W
Building a new DOS disklabel. Changes will remain in memory only,
2 c- u7 W* V4 h1 T until you decide to write them. After that, of course, the previous' t& Z% G1 n! r9 ]. o, c
content won't be recoverable.
( I+ ~) |! u) ]+ L0 c The number of cylinders for this disk is set to 8322.$ V& U/ _/ i5 ?! }
There is nothing wrong with that, but this is larger than 1024,
. b6 |( k2 q+ M. N and could in certain setups cause problems with:
9 X. n/ O# `% I0 b$ O 1) software that runs at boot time (e.g., old versions of LILO)" F, o& t' }$ u! q8 R7 v- s/ U
2) booting and partitioning software from other OSs
' [' h" D/ ~% F+ k (e.g., DOS FDISK, OS/2 FDISK)+ o* I$ q4 R0 F! ~9 Z( Z
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
: C+ e4 w) M& M; z+ S$ S0 V; f0 l Command (m for help): p0 u2 |+ Y- S5 Y+ j
Disk /dev/hda: 4294 MB, 4294967296 bytes
! e0 Q5 O/ U1 T, X+ r ~9 s* F 16 heads, 63 sectors/track, 8322 cylinders4 e5 H7 s+ h/ \( _/ X g) W7 u
Units = cylinders of 1008 * 512 = 516096 bytes! l! o5 D$ o+ W3 ~* K
Device Boot Start End Blocks Id System
3 c# O# V2 p! ^; W Command (m for help): m
$ Y x8 e6 ]" @5 e! ~ Command action
- V6 _3 j1 V; ]8 L a toggle a bootable flag: g$ F0 j& k# ^( e* q6 v& ?2 v
b edit bsd disklabel- a4 l' l. X% U4 T5 C
c toggle the dos compatibility flag
3 W0 k- j0 r9 ^" s. L2 ?1 M; ]! J# l* C3 F d delete a partition3 n! T1 A+ ]7 J1 l
l list known partition types+ d* B9 ^6 {9 W: W7 S* Q
m print this menu$ j( [/ ?; T4 J. |) ~: r
n add a new partition) r3 t% X; c8 O
o create a new empty DOS partition table
( g2 S: A( l8 J3 X" g" m0 L1 W p print the partition table3 r: t+ {) v; D# O' Z
q quit without saving changes
+ f3 X7 d* E4 m4 g s create a new empty Sun disklabel
" ?' h. ]$ e/ V9 j* `. ^ t change a partition's system id9 h9 |4 ]( R+ X& @, c
u change display/entry units
) g5 C( r* k/ R/ E P" E v verify the partition table* s) b8 p/ e1 L1 p: a @9 \' J" m5 H
w write table to disk and exit
- K' f% Y. L& [, _- ~" ? x extra functionality (experts only)4 M$ j+ `: T- a
Command (m for help): n
; y1 t* w2 i3 k! c2 f Command action
" Y1 L" Y/ T% I: p6 A; p. i e extended
* G1 x* R( d; l" P8 c p primary partition (1-4)
8 a Q, O% K6 Z( g: Z' }4 d& b p
' y8 ]! ^* n0 M# d1 ?5 J0 y, x4 k Partition number (1-4): 1/ u. a' I4 O5 A3 C
First cylinder (1-8322, default 1):
+ Z- W1 o4 @& ` Using default value 1
3 v' ?! y) k9 ^$ n3 O Last cylinder or +size or +sizeM or +sizeK (1-8322, default 8322): 1000G
& t# g/ O9 C" m3 T Command (m for help): p2 v' g# D: y. j8 @" B
Disk /dev/hda: 4294 MB, 4294967296 bytes3 {3 | p3 S! A, u
16 heads, 63 sectors/track, 8322 cylinders% ]. ~* F+ Z3 w( s3 Y
Units = cylinders of 1008 * 512 = 516096 bytes
6 \0 D& n5 E d$ _ Device Boot Start End Blocks Id System% ]$ o7 Y# i2 m$ b
/dev/hda1 1 1000 503968+ 83 Linux
+ n% z7 f3 W/ r( } Command (m for help): w- g+ O) Q* ]9 _' s9 F/ K' V
The partition table has been altered!
3 v2 Y0 g, p- B# m Calling ioctl() to re-read partition table.
* F8 e; C. q) N! a Syncing disks.
( m. u8 ~! V- J. `1 K //格式化新分区4 h$ \6 }5 p* \% f- k$ f/ y3 M
mke2fs 1.32 (09-Nov-2002)
9 z7 `0 p& x% d7 _% d Filesystem label=& B7 g' S, H: U( U# R: s
OS type: Linux
`6 u! a. r. j# Z Block size=1024 (log=0)
; e0 `3 F$ f4 t" e Fragment size=1024 (log=0)
. f# C2 F" m1 d" L2 L3 _ 126480 inodes, 503968 blocks3 a" ]. n% Q6 p4 u+ C0 G6 K
25198 blocks (5.00%) reserved for the super user. P8 _, ~+ p* d) z B. N
First data block=1
1 W% u- j% x2 y( H$ J& ] 62 block groups
4 z( ]0 G \& d% v! p8 {% y 8192 blocks per group, 8192 fragments per group9 A+ p: p) H) m" c# D7 S1 s
2040 inodes per group" e8 }, H+ O t% O
Superblock backups stored on blocks: 7 o) M& u: `4 \. V/ m; z
8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
2 W& U( i8 Y$ |0 \# Z4 u Writing inode tables: done 3 Q0 k, v' ~+ J. U6 t8 X: K! K7 L, u1 ^
Creating journal (8192 blocks): done
, z1 i8 L2 O+ D0 S- s Writing superblocks and filesystem accounting information: done0 F6 s3 f9 L+ k, h
This filesystem will be automatically checked every 30 mounts or& a, J. \1 |7 M Y$ ^, W- b0 F
180 days, whichever comes first. Use tune2fs -c or -i to override.
. n: V; C# m4 B" m0 O0 G% E y文件系统 1K-块 已用 可用 已用% 挂载点
- S* U$ ~% c+ k& [' M /dev/sda3 3723848 705992 2828692 20% /
3 v5 a. l7 C8 {$ |6 `+ d. n( g' r" l /dev/sda1 101089 9274 86596 10% /boot! w3 v2 {! R5 o
none 14520 0 14520 0% /dev/shm, ]' |3 A2 P0 ~$ _4 J$ G
//挂上新分区
. t9 H2 Q2 x/ |, [" O- mount /dev/hda1 /home
9 U# { Y/ M; T( Q" A3 t - df -k
复制代码 文件系统 1K-块 已用 可用 已用% 挂载点
5 X& l* ?4 A8 a7 y /dev/sda3 3723848 705992 2828692 20% /
& M2 c, O9 g+ {2 e- Q) t9 S /dev/sda1 101089 9274 86596 10% /boot
5 f8 e4 u/ X2 @3 a" ^ none 14520 0 14520 0% /dev/shm9 F9 h* h# t; B
/dev/hda1 488006 8239 454569 2% /home% j( i9 S$ V7 ]
8 A* A" b: g* B- h6 r自动挂载:3 p! J: N1 C( R }% Y
- vi /etc/fstab
/ d% |! e! b5 g/ P
2 Q) `- I; _& W( @5 }# z9 U, ^& `- /dev/sdb5 /mnt/ljp1 ext3 defaults 0 0. b' @/ R4 d5 D0 Y2 W( `( N
0 j, m0 B$ E2 g1 d; X* |$ a' D& m+ Y- /dev/sdb6 /mnt/ljp2 ext3 defaults 0 0
复制代码 手动挂载:
: i9 ^1 N& T* c3 S- mount /dev/sdb5 /mnt/ljp1; W+ i$ k" q% L; Q
' n! o, l8 }8 m( [& y" H: D' x- mount /dev/sdb6 /mnt/ljp2
复制代码
& `. w5 l: Y6 p& v4 q: R9 M# c1 x& s* a& O1 v9 e( B9 o8 |& H
2 G+ _0 R ]; b& @2 c
|
|