linux下对活动硬盘分区

    以前分区都是在WIN下做的,因为是图形界面,所以很容易就做到了。linux下呢,现在就尝试来做一做。
    先查找了fdisk命令怎么使用。下面是这次做的步骤:
    通过fdisk -l查看到活动硬盘是sda,于是
    $ fdisk /dev/sda
        The number of cylinders for this disk is set to 12161.
        There is nothing wrong with that, but this is larger than 1024,
        and could in certain setups cause problems with:
        1) software that runs at boot time (e.g., old versions of LILO)
        2) booting and partitioning software from other OSs
           (e.g., DOS FDISK, OS/2 FDISK)

    选择n建立分区
        Command (m for help): n
        Command action
          e   extended
          p   primary partition (1-4)

    将活动硬盘分为两个分区,所以分两次选择了p,建立基本分区。再键入p显示:
        Command (m for help): p
        Disk /dev/sda: 100.0 GB, 100030242816 bytes
        255 heads, 63 sectors/track, 12161 cylinders
        Units = cylinders of 16065 * 512 = 8225280 bytes

           Device Boot      Start         End      Blocks   Id  System
        /dev/sda1               1        4864    39070048+   b  linux
        /dev/sda2            4865       12161    58613152+   b  linux

    再键入t对分区类型进行改变。
        Command (m for help): t
        Partition number (1-4): 1
        Hex code (type L to list codes): b
        Changed system type of partition 1 to b (W95 FAT32)

    w保存退出。

    上面做得都很顺利,退到shell下可以使用fdisk -l看到:

    chen@chen-laptop:~$ fdisk -l

    Disk /dev/sda: 100.0 GB, 100030242816 bytes
    255 heads, 63 sectors/track, 12161 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

       Device Boot      Start         End      Blocks   Id  System
        /dev/sda1               1        4864    39070048+   b  W95 FAT32
        /dev/sda2            4865       12161    58613152+   b  W95 FAT32

    但是...还没完。分完区以后还要做格式化,差点忘了,和WIN一样嘛^_^
        $ sudo mkfs.vfat /dev/sda1
        $ sudo mkfs.ext2 /dev/sda2
        
    将活动硬盘重新接到计算机上,ubuntu自动挂载上了两个分区。
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值