parted的用法
1:
root@joe-Aspire-Z3730:/home/joe# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) help
align-check TYPE N check partition N for TYPE(min|opt)
alignment
check NUMBER do a simple check on the file system
cp [FROM-DEVICE] FROM-NUMBER TO-NUMBER copy file system to another partition
help [COMMAND] print general help, or help on
COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition
table)
mkfs NUMBER FS-TYPE make a FS-TYPE file system on
partition NUMBER
mkpart PART-TYPE [FS-TYPE] START END make a partition
mkpartfs PART-TYPE FS-TYPE START END make a partition with a file system
move NUMBER START END move partition NUMBER
name NUMBER NAME name partition NUMBER as NAME
print [devices|free|list,all|NUMBER] display the partition table,
available devices, free space, all found partitions, or a particular
partition
quit exit program
rescue START END rescue a lost partition near START
and END
resize NUMBER START END resize partition NUMBER and its file
system
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
set NUMBER FLAG STATE change the FLAG on partition NUMBER
toggle [NUMBER [FLAG]] toggle the state of FLAG on partition
NUMBER
unit UNIT set the default unit to UNIT
version display the version number and
copyright information of GNU Parted
(parted) print
Model: WD Elements 25A2 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 200GB 200GB ext4
2 200GB 201GB 500MB linux-swap(v1)
3 201GB 301GB 100GB ext4 newpart
(parted) mkpart primary ext4 301GB 801GB
(parted) print
Model: WD Elements 25A2 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 200GB 200GB ext4
2 200GB 201GB 500MB linux-swap(v1)
3 201GB 301GB 100GB ext4 newpart
4 301GB 801GB 500GB primary
(parted) quit
Information: You may need to update /etc/fstab.
2:
root@joe-Aspire-Z3730:/home/joe# mkfs -t ext4 /dev/sdb4
mke2fs 1.42 (29-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
30523392 inodes, 122070272 blocks
6103513 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
3726 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
3:
joe@joe-Aspire-Z3730:/etc$ sudo mkdir /mnt/sdb3 /mnt/sdb4
joe@joe-Aspire-Z3730:/etc$ sudo blkid
[sudo] password for joe:
/dev/sda1: LABEL="ESP" UUID="4ABB-A3E1" TYPE="vfat"
/dev/sda3: UUID="0009D593000EBB38" TYPE="ntfs"
/dev/sda4: UUID="0C9708180C970818" TYPE="ntfs"
/dev/sda5: LABEL="WINRETOOLS" UUID="E27896DC7896AEB3" TYPE="ntfs"
/dev/sda6: LABEL="Image" UUID="8688974D88973A9F" TYPE="ntfs"
/dev/sda7: LABEL="DELLSUPPORT" UUID="4824D3AB24D39A70" TYPE="ntfs"
/dev/sdb1: UUID="53ed3b5d-4332-4d2f-a7aa-1893689658c9" TYPE="ext4"
/dev/sdb2: UUID="96fc32d4-99ad-4ff5-b38a-3649b9608a1d" TYPE="swap"
/dev/sdb3: UUID="8285e8b2-79a4-4b1a-bf52-5167a20ca158" TYPE="ext4"
/dev/sdb4: UUID="46bb100d-2505-4025-8425-34ecf3129209" TYPE="ext4"
joe@joe-Aspire-Z3730:/etc$ sudo gedit fstab
UUID=8285e8b2-79a4-4b1a-bf52-5167a20ca158 /mnt/sdb3 ext4 defaults 0 0
UUID=46bb100d-2505-4025-8425-34ecf3129209 /mnt/sdb4 ext4 defaults 0 0
最后重启电脑