Nov 19, 2015 HFS+: This MAC propriety file system and is used in iOS and MAC. If you format your external hard drive to HFS, you can use it on MAC and Linux (by removing journaling). However, to use it on Windows you can HFS explorer (read only). Ext4: This is a default file system for linux. Jul 13, 2016 Make sure you pass in the partition and not the entire disk.In Linux, disks have names like sda, sdb, hda, etc.The partitions on these disks have a number appended to the end. So we would want to use something like sda1 and not sda. Sudo mkfs.ext4 -L datapartition /dev/sda1; If you want to change the partition label at a later date, you can use the e2label command.
Jul 14, 2020 • Filed to: Answer Hard Drive Problems • Proven solutions
How can I erase an entire Linux disk space? My hard drive is running out of space and I would like to wipe disk of my Linux computer to create more storage.
If you also own a Linux system, which is running on low disk space, then you might be facing a similar situation. Although Linux is one of the most popular open-source operating systems, it can be a bit complicated at times. For instance, there is no direct solution to do a Linux format disk using a dedicated GUI feature. Don’t worry – you can still erase disk on Linux with the help of the right commands. Read on and clear your Linux disk space by following this extensive guide.
ContentPart 1: Why We Need to Format and Wipe Linux Disk?
Before we get to know different ways to format a disk on Linux, it is vital to understand the reasons behind it. Ideally, there could be following major reasons for wiping or formatting a disk on a Linux system:
Part 2: How to Format a Linux Hard Drive?
Unlike Windows or macOS, there is not a dedicated disk management tool that can help us partition or format the disk. Therefore, we need to take the assistance of certain commands to format a Linux disk. If you are connecting your drive for the first time to your Linux system, then you need to create a partition beforehand. To implement this, you can enter the fdisk command. Once a partition is created, you can use the “mkfs.ext4” command to format the disk. Here’s a simple solution to format a disk on a Linux system.
Step 1: Create a partition of the disk
Firstly, connect the disk to your Linux system if you haven’t already and launch the Terminal window on it. You can enter the following command to check it:
sudo fdisk –l.
Now, to create a partition, enter the command “fdsk” in the following format:
sudo fdisk /dev/sdb.
This will launch the results of the fdisk command. If you want, you can type “m” to get help. It will display a list of the supported parameters. You can type “n” to create a new partition, “d” to delete the partition, “p” to check the partition table, and so on.
Firstly, press “p” and enter to view the partition table. This will let you know about the disk identifier and the sector space. Subsequently, enter the “n” command to create a new partition. You will be given an option to create a primary or an extended partition. Press “p” to create a new primary partition and give it a number from 1 to 4. If you want to create a single partition, then enter “1”.
Step 2: Format the disk
Great! Once you have created the relevant partition on your Linux system, you can format it by entering the command –
sudo mkfs.ext4 /dev/sdb.
This will make the system look for the available partitions on the drive. When you are asked to confirm your choice, just press “y”. Afterward, wait for a while as the selected partitions would be formatted on the Linux system.
Step 3: Mount the file system (optional)
If you want, you can mount the file system as well. To do this, you can use the “mkdir /data” command to make a directory. After that, end the following command to mount it:
mount /dev/sdb1 /data.
Part 3: How to Wipe a Hard Drive on Linux?
If you are planning to resell your system or are concerned about your privacy, then you should consider wiping the drive instead. Unlike formatting a disk, wiping it will erase the data and make the recovery process harder than before. Thankfully, there are multiple commands to do Linux wipe the disk. Here are some simple solutions to wipe a hard drive on Linux.
1. wipe
As the name suggests, the command is used to wipe data from a magnetic disk. Though, a lot of Linux systems do not have the command readily installed. In this case, you can use the apt install command first.
# apt install wipe.
Once it is done, just use the “wipe” command in the format - wipe [options] target. For instance, to wipe a partition, simply enter the command:
# wipe /dev/sda2
Confirm your choice, by entering “yes” and wait as the selected partition would be wiped.
2. shred
This is one of the best ways to protect your private data on a Linux system. Ideally, this works as a dedicated shredder – that would overwrite your data with something else, making the recovery process harder. This Linux based command has the following syntax:
shred [option] target
As you know, “target” would specify the location you wish to shred. It can be a partition, folder, or file name. Subsequently, it can have the following options.
Therefore, you can wipe the Linux disk, by entering a command like this:
# shred -vfz -n 10 /dev/sda2.
This will follow ten passes of overwriting on the provided location, making it impossible for a recovery tool to retrieve data from it.
3. dd
If you are running short on time, then consider using the “dd” command to erase disk on a Linux system. Instead of generating random data, it will overwrite the entire disk with strings of zeros. Therefore, it will take less time to wipe the disk and protecting your information. Although, it provides certain options that you can use to customize the process.
Best Disk Format For Mac
dd if=source of=target [Options].
Make sure that you run the command prompt and as a super-user. Here’s a simple demonstration of the same.
# dd if=/dev/zero of=/dev/sda2 bs=512 count=1.
The command will overwrite the target location with a string of zeros, as specified in the source. Also, this will copy 512 bytes in a single count. One of the major advantages of this is the time taken by the dd command is lesser than shred.
4. scrub
Lastly, you can also take the assistance of the “scrub” command to overwrite your disk with specific patterns. Sometimes, the patterns can be randomly generated by the system too. Since the command is not present in every Linux system by default, you might need to install it first. To do this, you can use the apt install command.
Once it is done, just enter the command in the following syntax:
scrub [option] target.
Even if you don’t provide an option and just specifies the target location to wipe, the command will work. Though, you would be asked to verify your choice to erase disk on Linux entirely. Here’s a quick example of the same:
# scrub /dev/sda5.
Part 4: Tips for Formatting and Wiping Linux Disk
After getting to know about these popular commands to create new disk space on Linux, you would certainly be able to format or wipe it. Besides that, you can consider following these tips to format or wipe the Linux disk successfully.
That’s a wrap, folks! Now when you know how to format or wipe disk on Linux, you can easily meet your requirements. In case if you have accidentally deleted your data or have formatted a drive, then use a reliable data recovery solution like Recoverit Data Recovery. Using it, you can just attach your Linux device to a PC and later extract the lost or inaccessible content from it. Go ahead and try some of these methods and feel free to share your own shortcuts or tips in the comments below.
Video Tutorial on How to Recover Data from Hard Disk After Disk WipeWhat's Wrong with Drive
There are many reasons why you may want to format an external HDD or small flash drive. For instance:
Warming: Formating a drive, also erase its data. Although you can still get it back, but it’s much harder after formatting. So if you can’t afford losing you data, take backup.
Which Format to choose?
Choosing a right file system is a bit tricky, so here are some pros and cons of all file system.
NTFS: This is windows propriety file system. Most external drives come preformatted in NTFS so that they can be used easily with Windows. However, NTFS drives are read only in MAC, but you can get write access by using software like NTFS-3g. It also works in Linux. And to support NTFS on Android use Stick mount or Paragon NTFS, HFS and exFAT.
HFS+: This MAC propriety file system and is used in iOS and MAC. If you format your external hard drive to HFS, you can use it on MAC and Linux (by removing journaling). However, to use it on Windows you can HFS explorer (read only).
ext4: This is a default file system for linux OS (including Raspberry Pi). To read an ext4 drive on Windows, you can Ext2Read and OSXfuse for MAC. However, I have not really use this format much, so we just skip it.
FAT32: This oldest file system and work with all OS i.e. Windows, MAC, Linux, Android, even TV, and PS3 etc. This is why it’s used in all small flash drive. Although it lacks all modern features and comes with 4 GB limit for single file size.
Format Disk For Mac
exFAT: is the extended version of exFAT. It works fine with Windows and MAC (all the modern version). For Android, you can use Stick mount app (root needed). However being a windows propriety file system, it does not play well in open source environment. But unlike FAT32, it does not have 4GB limit for single file size. Thus making it ideal for SDcards of the high-end camera.
How to Format an External Hard drive or Pen drive
Now that we know the good and bad about every file system, let see how to format a drive in Windows, MAC, and Linux.
Windows
Formatting a drive on Windows is quite simple. Plug in your external HDD to the USB port of your computer> then go to my computer > find your external drive > right-click it > and select format.
A new window will open, select the desired file system, keep the allocation unit size to default and check mark quick format (or it will take more time). Once done hit the format button and that’s it. Within seconds, you will have your drive in the new format.
Note: While formatting a pen drive you will see FAT32, exFAT, and NTFS as the available file system. However for external HDD you won’t see the FAT32 (windows don’t suggest fat32 for bigger drives) However to get other format option you can use third-party software.
MAC
Start by connecting your external HDD to MAC’s USB port. Under the finder men, go to Go > utilities > Disk Utility or type disk utility in the spotlight and hit enter.
Once under disk utility. Select your external HDD on the left side and then select partition option.
Now in the Partition area, click under Partition Layout and select 1 Partition. Then, click on Options. A new window will open, here select Master Boot Record and then click Ok.
Now in the right side of windows, give a name to your drive, from the drop-down select desired file system format. Make sure the size is set to an entire volume of your external drive. And once done, click on Apply.
Note: Here you will also see an option to format a large hard drive to FAT32 which is not available in Windows.
See this animated gif (Imgur)
Linux
Unlike windows and MAC, Linux does not a have built-in partition tool. So, you will have ti install a GUI tool called GParted and then plug in your external drive in the computer.
Format Mac Disk In Windows
Open your terminal and type in the following command to install GParterd.
sudo apt-get install gparted
Format Mac Disk For Pc
Once installed, type the following command to launch the program.
sudo gparted
A new window will open. Click on the top right side, select the volume you want to format.
Once you see the volume you want to format, right click on the block and select format > choose the file system you want > and click OK to confirm.
Note: Since, I am running Linux in a virtual machine, in final step my Format to option is not highlighted, But in your case, you will be able to click it and select the file system you to format in. To see the final step, I suggest you check out this howtogeek article.
Android![]() Mac Format External Disk
Say you don’t have any computer with you, now can you still format your external HDD? Well, if you have an Android (ROOT) then yes, you can still format your drive to popular formats like NTFS and HFS.
Mac Software Format Disks Linux Free
To do this, install Paragon exFAT, NTFS & HFS+ from Play store. The main function of this application is to mount NTFS or HFS formatted HDD on Android, but there is another useful option hidden under settings — i.e. formatting a drive.
Mac Disk Format Tool
Once installed, open the app, mount your drive and then go to the settings, There select the new file system for your drive, give it a name and hit format.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |