# 修改分區ID号
[[email protected] /]# fdisk /dev/sdb
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap / Solaris)
Command (m for help): p
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd406d040
Device Boot Start End Blocks Id System
/dev/sdb1 1 2 16033+ 83 Linux
/dev/sdb2 3 4 16065 82 Linux swap / Solaris
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
# 讀取硬碟分區表
[[email protected] /]# partx -a -n 2 /dev/sdb
BLKPG: Device or resource busy
error adding partition 2 #雖然提示error但是沒事
BLKPG: Device or resource busy
error adding partition 3
#設定為交換分區
[[email protected] /]# mkswap /dev/sdb2
Setting up swapspace version 1, size = 16060 KiB
no label, UUID=09727f1e-eb7c-4b64-9a17-542cb6879b59
# 檢視分區資訊
[[email protected] /]# blkid /dev/sdb2
/dev/sdb2: UUID="09727f1e-eb7c-4b64-9a17-542cb6879b59" TYPE="swap"
# 格式化分區,劃分檔案系統
[[email protected] ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
檔案系統标簽=
作業系統:Linux
塊大小=1024 (log=0)
分塊大小=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
4016 inodes, 16032 blocks
801 blocks (5.00%) reserved for the super user
第一個資料塊=1
Maximum filesystem blocks=16515072
2 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks:
8193
正在寫入inode表: 完成
Creating journal (1024 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.