[email protected]:~$
sudo fdisk -l
[sudo] password for wang: Disk /dev/loop0: 18.4 MiB, 19243008 bytes, 37584 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop1: 86.9 MiB, 91099136 bytes, 177928 sectors
Disk /dev/loop2: 86.6 MiB, 90812416 bytes, 177368 sectors
Disk /dev/loop3: 86.9 MiB, 91115520 bytes, 177960 sectors
Disk /dev/loop4: 18.5 MiB, 19410944 bytes, 37912 sectors
Ignoring extra data in partition table 5. Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 sectors
Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors
Disk /dev/sdc: 20 GiB, 21474836480 bytes, 41943040 sectors
[email protected]:~$ sudo -i [email protected]:~#
sudo fdisk /dev/sdc
Welcome to fdisk (util-linux 2.27.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.
Device does not contain a recognized partition table. Created a new DOS disklabel with disk identifier 0x30d8c8fe.
Command (m for help):
m
Help:
DOS (MBR)
a toggle a bootable flag
b edit nested BSD disklabel
c toggle the dos compatibility flag
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
u change display/entry units
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help):
n
Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p):
p
Partition number (1-4, default 1): First sector (2048-41943039, default 2048): Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039):
Created a new partition 1 of type ‘Linux‘ and of size 20 GiB.
Command (m for help):
m
Help:
DOS (MBR) a toggle a bootable flag b edit nested BSD disklabel c toggle the dos compatibility flag
Generic d delete a partition F list free unpartitioned space l list known partition types n add a new partition p print the partition table t change a partition type v verify the partition table i print information about a partition
Misc m print this menu u change display/entry units x extra functionality (experts only)
Script I load disk layout from sfdisk script file O dump disk layout to sfdisk script file
Save & Exit w write table to disk and exit q quit without saving changes
Create a new label g create a new empty GPT partition table G create a new empty SGI (IRIX) partition table o create a new empty DOS partition table s create a new empty Sun partition table
Command (m for help): w
The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks.
root@ubuntu:~# fdisk -l
Disk /dev/loop0: 18.4 MiB, 19243008 bytes, 37584 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop1: 86.9 MiB, 91099136 bytes, 177928 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop2: 86.6 MiB, 90812416 bytes, 177368 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop3: 86.9 MiB, 91115520 bytes, 177960 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/loop4: 18.5 MiB, 19410944 bytes, 37912 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
Ignoring extra data in partition table 5. Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x7f792d7e
Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 81788927 81786880 39G 83 Linux /dev/sda2 81790974 83884031 2093058 1022M 5 Extended /dev/sda3 81788928 81790973 2046 1023K 83 Linux /dev/sda5 81790976 83884031 2093056 1022M 82 Linux swap / Solaris
Partition table entries are not in disk order.
Disk /dev/sdb: 20 GiB, 21474836480 bytes, 41943040 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x451fa6fd
Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 41943039 41940992 20G 83 Linux
Disk /dev/sdc: 20 GiB, 21474836480 bytes, 41943040 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x30d8c8fe
Device Boot Start End Sectors Size Id Type /dev/sdc1 2048 41943039 41940992 20G 83 Linux
[email protected]:~#
mkfs .ext3 /dev/sdc1
mke2fs 1.42.13 (17-May-2015) mkfs.ext2: invalid blocks ‘/dev/sdc1‘ on device ‘.ext3‘ [email protected]:~# mkfs.ext3 /dev/sdc1 mke2fs 1.42.13 (17-May-2015) Creating filesystem with 5242624 4k blocks and 1310720 inodes Filesystem UUID: 766c2620-d366-460d-b7ec-3a799ae9be49 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
[email protected]:~#
sudo vim /etc/fstab
# /etc/fstab: static file system information.
#
# Use ‘blkid‘ to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=9cfc41d5-32f9-4d9f-a69c-1f4ae6a923c2 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=e4262916-28f9-4d52-8509-78ae291e15d8 none swap sw 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
/dev/sdc1 /eos_private ext3 defaults 0 0
/dev/sdb1 /eth_private ext3 defaults 0 0
[No write since last change] /bin/bash: q: command not found
shell returned 127
Press ENTER or type command to continue [No write since last change] /bin/bash: q: command not found
shell returned 127
原文地址:https://www.cnblogs.com/ximen/p/9272305.html