之前拿來做快照備份的硬碟掛了,趕緊換上一顆
以前都用fdisk,簡單好用,現在為處理大容量GPT格式須改用parted,稍稍複雜一些些。
參閱:Linux 的 Parted 指令教學:建立、變更與修復磁碟分割區。開始分割、格式化吧!

$sudo parted
)help

align-check TYPE N check partition N for TYPE(min|opt) alignment
help [COMMAND] print general help, or help on COMMAND
mklabel,mktable LABEL-TYPE create a new disklabel (partition table)
mkpart PART-TYPE [FS-TYPE] START END make a partition
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
resizepart NUMBER END resize partition NUMBER
rm NUMBER delete partition NUMBER
select DEVICE choose the device to edit
disk_set FLAG STATE change the FLAG on selected device
disk_toggle [FLAG] toggle the state of FLAG on selected device
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

我要切的是/dev/sdb 空硬碟 PS.一開始也可以像fdisk用法,後直接接device
)select /dev/sdb

因我硬碟只有800G(VM),所以做一般MBR格式也無妨
)mklabel msdos
)mkpart
Partition type? primary/extended? p
File system type? [ext2]? (預設不用動,到時自行格式化就好)
Start? 1
End? -1 (全給)

看一下結果
)print
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 859GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 859GB 859GB primary

離開
)quit

格式化為btrfs
$sudo mkfs.btrfs /dev/sdb1

取得UUID
$sudo blkid

建立資料夾(快照備份用)
$sudo mkdir /btrfs

掛載
$sudo vim /etc/fstab
UUID=luckylucky-8888-66666-168168-abcde123456 /btrfs btrfs defaults 0 0
$sudo mount -a

完成,samba、SELinux、acl、snapper得重弄了吧!?睡了,明日再進行

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *