Questions tagged [fdisk]
fdisk was a command-line disk partitioning tool in Linux and old versions of Windows/MS-DOS. It is deprecated on Linux by its inability to handle GPT disks. New systems should use diskpart (Windows) or parted (Linux) to partition disks.
156
questions
94
votes
18
answers
175k
views
Reread partition table without rebooting?
Sometimes, when resizing or otherwise mucking about with partitions on a disk, cfdisk will say:
Wrote partition table, but re-read table failed. Reboot to update table.
(This also happens with ...
67
votes
9
answers
269k
views
Deleting All Partitions From the Command Line
How do you delete all partitions on a device from the command line on Linux (specifically Ubuntu)? I tried looking at fdisk, but it presents an interactive prompt. I'm looking for a single command, ...
20
votes
5
answers
107k
views
How to reset a Harddisk (delete Mbr & delete Partitions) from the Command Line with a script without rebooting?
To start from a clean state I need to reset the hard disk to an empty state from command line.
It is not about running a wipe utility, the data don't have to be overwritten.
This question is quite ...
14
votes
2
answers
12k
views
Non-interactively create one partition with all available disk size
This is disgusting to me, but it works:
echo -e "n\np\n1\n\n\nt\nc\na\n1\nw" | fdisk /dev/sdb
I would like to know a more prudent or elegant way to accomplish this. The entire boot record and ...
11
votes
5
answers
45k
views
Resizing partition fdisk fails with invalid argument
I recently resized a VPS from a 50GB SSD to a 300GB SSD through my hoster's control panel. I now am trying to resize my main partition with fdisk to be able to use all the new space. However, fdisk ...
11
votes
2
answers
52k
views
using fdisk: show size in a unit such as MB or GB
doing a fdisk -l
is a quite convenient command, but how to make fidsk print the partition size in a unit such as MB or GB?
11
votes
1
answer
13k
views
What is the difference between the Linux and Linux LVM partition type?
Fdisk shows multiple partition types. What is the difference between choosing 83) Linux and 8e) Linux LVM?
Choosing 83) Linux also works fine for using LVM, even creating a physical volume on /dev/...
10
votes
6
answers
40k
views
fdisk - partition in single line
Can you create a partition in a usb disk using fdisk command in a single line.
fdisk command is interactive in nature, But I want to automate partition creation in a single line using fdisk command.
10
votes
2
answers
3k
views
After hardware RAID array expansion fdisk wont allow me to use additional available sectors
We have a large ~18TB hardware raid array on a Dell R720xd. Currently the RAID5 array consists of 6x4TB and I needed to extend it.
Step 1 expand the hardware raid array.
Simple enough if you have ...
9
votes
3
answers
35k
views
e2label Bad magic number in super-block?
This is the output of fdisk:
[root@ns1 ~]# fdisk -l
Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device ...
8
votes
2
answers
21k
views
I used "dd" to clone a drive to a larger drive. How can I leverage the additional space (linux)?
Fdisk can't see extra space
I upgraded my trusty 74gb Raptor hard drive to a 600gb Velociraptor behemoth.
I used "dd" to clone the drive, (i.e. "dd if=old-drive-device of="new-drive-device), swapped ...
8
votes
2
answers
6k
views
Is the fdisk partition type important when using lvm
I have inherited a few LVM volumes and I noticed that fdisk reports the disks that make up the volume group as partition type 83 (Linux) and not 8e (Linux LVM). Is this a problem and how important ...
7
votes
2
answers
13k
views
df showing wrong disk size
Df -h is showing a wrong empty space on my server, for one of the disks:
/dev/sda2 450G 393G 34G 93% /
Cpanel shows that it has only 34GB free, but there is a lot more. A few minutes ...
6
votes
1
answer
9k
views
Merge Logical Volume groups
I want to increase root LVM volume space. Is it possible to merge LogVol01 to LogVol00? My LVM setup looks like this:
[root@server~]# lvs
LV VG Attr LSize Origin Snap% Move ...
6
votes
2
answers
13k
views
How can I set the disk partition alignment using linux tools?
After reading Disk Partition Alignment Best Practices for SQL Server, I just want to give those advices a try, but on my linux test server. What are the required parameters in order to set the ...
5
votes
2
answers
6k
views
Repurposed disk - Linux blkid command returns incorrect information
I'm working with an SSD drive removed from a VMware ESXi installation. I'm trying to reuse the disk in an existing Linux installation (CentOS 6.2). The drive sits behind an HP Smart Array P410 RAID ...
5
votes
1
answer
3k
views
Why is disk label type dos but the partition system is GPT?
And how can it be larger than 2TB if it's dos?
Disk /dev/sdi: 6000.6 GB, 6000606183424 bytes, 11719933952 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / ...
4
votes
6
answers
24k
views
How to view if partitions primary or secondary in Linux
How do I view my partitions if they are primary or secondary in Linux CentOS? I tried df -T but it does not show if partitions are primary or secondary.
4
votes
2
answers
5k
views
Cannot mount /dev/sdc1 on Debian 5.0, special device /dev/sdc1 doesn't exist
I'm trying to fix an odd problem I'm having that I've never seen or heard of before. I have a disk, /dev/sdc and I'm trying to mount it, but cannot.
sudo mount /dev/sdc1 /mnt
mount: you must ...
4
votes
1
answer
733
views
Why does fdisk have a discrepancy in translating units between cylinder and sectors?
We were re-partitioning a virtual disk to increase the size of an LVM's physical volume.
This is how we initially performed this:
$ fdisk /dev/sdb
# delete partition
fdisk> d
? 1
# create new ...
3
votes
4
answers
10k
views
Can you change the partition type on a linux server without starting up fdisk?
I'm looking for a way to change a partition type on a linux system without starting fdisk. (In this particular case from "linux" to "softwareRAID")
The ultimate goal here is a script that is going ...
3
votes
1
answer
2k
views
Where did the free space go?
I have installed CentOS 5.7 64 Bits in my server which has 4x300 GB SAS drives on hardware RAID 10. At the installation, I chose default partitions.
Here are the commands output:
[root@server ~]# ...
3
votes
5
answers
11k
views
how do you mount and format /dev/sda to a different /dev/ name?
We have linux box running fedora. It has a small laptop hard drive running the OS and a 3ware RAID controller running 3 SATA drives RAID 5.
When we boot the computer and login, I run “fdisk –l” ...
3
votes
3
answers
2k
views
Aligned partitioning of 2TB disk with Linux fdisk
Is there a way to create a single 2TB partition, which is 4096-byte-sector aligned, on a disk using the standard Linux fdisk (I have tried version 2.17.2)?
I've tried the following things and ran ...
3
votes
2
answers
1k
views
same harddrive on the same controller, but different cylinder/head/sector
I have a pair of identical SATA harddrives connected to the same controller, but for some reason, fdisk under Debian 6 reports different CHS:
user@host:~$ sudo fdisk -l /dev/sdc
Disk /dev/sdc: 1000....
3
votes
1
answer
1k
views
LVM in Linux with fdisk?
This question is similar to Is the fdisk partition type important when using lvm however will ask it for clarity.
On a CentOS 6.5 insall, I accidentally took a new 3TB virtual disk and performed the ...
3
votes
3
answers
3k
views
LVM2 vgreduce unknown physical volume from root logical volume CentOS8
I have a removable disk in my CentOS8, but I can't reduce the volume group:
[root@localhost ~]# vgs
WARNING: Couldn't find device with uuid 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: VG cl ...
3
votes
2
answers
2k
views
OpenBSD - Image on a new, bigger disk - how to use the extra space
Our present OpenBSD server needed more disk space, so we replaced the 13 GB disk (it's pretty old too) with 150GB. An image was made and then restored on the new disk. So far, so good.
The new disk ...
3
votes
0
answers
512
views
how to setup 4 drives on hetzner servers, every two are mirror
I've a new dedicated server from hetzner, will install cPanel on it.
2x HDD SATA 6,0 TB Enterprise
2x SSD M.2 NVMe 512 GB
OS is AlmaLinux v8.7.0
how can I set up the installimage so the OS be on the ...
3
votes
0
answers
4k
views
In linux, determine if a block device is being used
I'm doing automation that will reformat a new disk and mount it. I want my automation to check and make sure the disk isn't in use so I don't break something that was already running (as happened to ...
2
votes
1
answer
3k
views
Unable to extend partition with gdisk on XenServer 6.5
I'm having trouble extending my partition on a XenServer 6.5. I originally had a 1.4TiB device (hardware RAID5) that I since upgraded to 10.9TiB. I upgraded the RAID by swapping out one disk at a ...
2
votes
3
answers
8k
views
How to move a directory to newly mounted drive?
What is the easier way to move a directory to newly mounted drive
Example, if I have a directory called /example and mounted a new drive to /vol, how I can easily move /example to /vol
Since ...
2
votes
1
answer
4k
views
extend MBR disk with ext4 partition to over 2 TB on CentOS 7
I have a CentOS 7 machine with two disks mounted [ /dev/sda and /dev/sdb ] using ext4.
I need to extend /dev/sdb1 to over 2 TB.
I extended the disk from 2 TB to 2.5 TB (google cloud)
After using fdisk ...
2
votes
1
answer
19k
views
Can't run drbdadm up with DRBD 8.4 on CentOS 7.3
Nodes:
node1
node2
Use this way installed DRBD on both nodes:
rpm -ivh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
yum -y ...
2
votes
2
answers
27k
views
The Linux SCSI layer does not automatically remap LUN assignments
I've got some iSCSI/FC storage, currently using only iSCSI.
I have in general no problems with mounting LUNs - under Linux and under Windows.
Unfortunately - when I add LUN for my Linux iSCSI ...
2
votes
3
answers
970
views
Cannot allocate additional space after growing RAID array
I added three new drives to a Dell 2950 (running RHEL 5) with a PERC 6/i storage controller. The machine was previously running RAID 1 on two drives + hotswap. Rather than create an identical RAID 1 ...
2
votes
2
answers
9k
views
Ubuntu: /dev/sdb1 is apparently in use by the system; will not make a filesystem here
I get this error when I try to format dev/sdb1:
$ mkfs.ext4 -L data /dev/sdb1
mke2fs 1.42.13 (17-May-2015)
/dev/sdb1 is apparently in use by the system; will not make a filesystem here!
where /...
2
votes
2
answers
9k
views
LSI replace disk in raid1 with larger drives, how to expand raid to use free space
LSI MegaRAID SAS 9240-8i
Situation: 2 - 128GB drives in a raid1
I've replaced each drive, one at a time to let the raid rebuild. The raid now consists of
2 - 256GB drives in raid1
Filesystem ...
2
votes
1
answer
903
views
Replacement raid1 drive is one block smaller. What to do?
Apparently once should always leave a bit of empty space at the end of each raid1 partition.
But if we're too late for that, what can be done if a replacement RAID1 drive is slightly smaller than the ...
2
votes
1
answer
7k
views
how to sync/flush after fdisk in linux (busybox)
when I change the partition table in Linux (busybox) and exit fdisk I'm still able to mount the old partitions, until I perform a reboot
for example
a) system is setup and has a /dev/sda1 and /...
2
votes
1
answer
478
views
fdisk with a a single command fail in the second execution
I ran a script to format a disk with fdisk like this:
(echo n; echo p; echo $number_part; echo $firs_sector; echo $second_sector; echo t; echo $format; echo p; echo w) | fdisk /dev/$disk
when i ...
2
votes
1
answer
2k
views
Adding Extra Hard Drives Debian Fdisk
well I just got a new server and it's a little different than what I'm use to, when I run cfdisk I get
WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. ...
2
votes
1
answer
4k
views
How can I change a partition mount to var and still boot up?
My first question here on server fault. In my haste, I set up a local server with Centos 6.2 and let the Centos installer handle the partitions.
Big mistake, I know.
Anyway, the only problem I have ...
2
votes
1
answer
1k
views
swapping out a faulty drive in a raid array with a new one... but WD changed the block size?
I got a brand new (same model) WD Caviar Green drive to replace the faulty one in my 5x2TB Raid 5 array. However, the new disk appears to be slightly different. According to the internet, Western ...
2
votes
1
answer
906
views
How can i split a partition on Ubuntu?
I just purchased a brand new server on OVH with disk specification: 2 x480GB of SSD SOFT.
When i do df -h, the output is:
Filesystem Size Used Avail Use% Mounted on
/dev/root 20G 13G ...
2
votes
1
answer
238
views
Drawbacks with smaller fdisk partitions, mdadm RAID10, LVM and KVM?
I am setting up a new virtualized server with KVM and LVM.
The KVM host and all guests will be installed on a SSD drive.
Each guest will have access to a RAID10 array made of 4x3TB sata drives, used ...
2
votes
1
answer
3k
views
sfdisk given size exceeds max allowable
Hello i have a failed driver in a raid so i had to replace it with a new hard disk. The problem is that although both hard disk are Seagate 1TB they differ slightly in size
# sfdisk -s
/dev/sda: ...
2
votes
2
answers
4k
views
Partition size inconsistency after dd clone
We have recently upgraded a system HDD - it was 160GB, now 2TB. We upgraded as we were running low on space, mainly on /usr, and also on /home.
I prepared the new drive with a Live CD and GParted (...
2
votes
3
answers
11k
views
Recover partition table for lvm
I managed to run fdisk on the wrong disk. However I was able to save a log of the terminal session.
Fdisk before the accident:
~$ sudo fdisk -l /dev/sda
Disk /dev/sda: 320.1 GB, 320072933376 bytes
...
2
votes
1
answer
5k
views
How to extend partition in CentOS 8
I hope someone can help me here. I have below partition in my CentOS 8 which is a VM hosted in hyper-v 2012.
[root@appliance ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs ...