Difference between revisions of "Format a device"

From ArchWiki
Jump to: navigation, search
(Add merge request.)
(Move to File Systems.)
Line 1: Line 1:
[[Category:File systems]]
+
#REDIRECT [[File Systems#Format a device]]
{{Merge|File Systems|Format it self is simple while know which format to use is hard.}}
+
This is an HOWTO about device formatting.
+
 
+
{{Warning|formatting a device removes everything on it, make sure to backup everything you want to keep.}}
+
 
+
{{Note|the authors of this article cannot be considered responsible of any data loss, hardware deterioration or any other problem related to this article.}}
+
 
+
==Pre-requirements==
+
Before starting, you need to know which name Linux gave to your device. All device nodes are placed in {{ic|/dev}} by [[udev]]. Hard drives and USB sticks show up as {{ic|/dev/sdX}}, where "X" is a lowercase letter, while partitions show up as {{ic|/dev/sdxY}}, where "Y" is a number.
+
 
+
If the device you want to format is mounted, it will show up in the MOUNTPOINT column from:
+
 
+
$ lsblk
+
 
+
If your device is not mounted:
+
 
+
# mount /dev/sdxY /some/folder
+
 
+
And to unmount it, you can use ''umount'':
+
 
+
# umount /dev/sdxY
+
 
+
==Step 1: delete the previous partitions==
+
For that you can use {{Ic|fdisk}}:
+
# fdisk /dev/<your_device>
+
{{Note|enter {{Ic|m}} for the help}}
+
 
+
==Step 2: create the new file system==
+
=== In console===
+
To create a file system you just have to use {{Ic|mkfs}}:
+
# mkfs -t vfat /dev/<your_device>
+
 
+
As {{Ic|mkfs}} is just a unified front-end for the different mkfs scripts you need to install the packages providing these scripts.
+
 
+
{{Pkg|e2fsprogs}} contains:
+
* {{Ic|mkfs.ext2}}
+
* {{Ic|mkfs.ext3}}
+
* {{Ic|mkfs.ext4}}
+
* {{Ic|mkfs.ext4dev}}
+
{{Pkg|dosfstools}} provides FAT16 and FAT32 support:
+
* {{Ic|mkfs.vfat}}
+
* {{Ic|mkfs.msdos}}
+
{{Pkg|ntfsprogs}} contains:
+
* {{Ic|mkfs.ntfs}}
+
{{Pkg|jfsutils}} contains:
+
* {{Ic|mkfs.jfs}}
+
{{Pkg|xfsprogs}} contains:
+
* {{Ic|mkfs.xfs}}
+
{{Pkg|reiserfsprogs}} contains:
+
* {{Ic|mkfs.reiserfs}}
+
{{Pkg|btrfs-progs}} contains:
+
* {{Ic|mkfs.btrfs}}
+
 
+
==Step 3: check==
+
Now you can check the new file system with {{Ic|fsck}}:
+
# fsck /dev/<your_device>
+
 
+
== GUI tools ==
+
There are several GUI tools for partition management:
+
*[http://gparted.sourceforge.net/ GParted] (GTK) is available in extra
+
* {{pkg|gnome-disk-utility}}
+
*[http://www.kde-apps.org/content/show.php/KDE+Partition+Manager?content=89595 KDE Partition Manager] (KDE/Qt) is available in [[AUR]]
+

Revision as of 04:49, 30 July 2012