Questions tagged [fdisk]

fdisk (for "fixed disk") is a command-line utility that provides disk partitioning functions.

Filter by
Sorted by
Tagged with
30
votes
3answers
134k views

mount: wrong fs type, bad option, bad superblock

I added a new hard drive (/dev/sdb) to Ubuntu Server 16, ran parted /dev/sdb mklabel gpt and sudo parted /dev/sdb mkpart primary ext4 0G 1074GB. All went fine. Then I tried to mount the drive mkdir /...
27
votes
3answers
40k views

fdisk vs parted

I've been running a small media server at home for 10+ years and looking at replacing it (before it breaks). I intend to hook up a new drive to my old system, partition and format (ext4 seems most ...
25
votes
1answer
81k views

/dev/mapper in fdisk

After installing CentOS, I see several lines like /dev/mapper/centos_jackpc--11-swap and /dev/mapper/centos_jackpc--11-root when I issue fdisk -l. What is the purpose of these? And why do they not ...
23
votes
4answers
54k views

Finding the sector size of a partition

I answered this question, assuming that the *.img file had a sector size of 512. How do I query a device, or the image of a device, to find the correct sector size?
21
votes
2answers
54k views

How can I use fdisk to create a ntfs partition on /dev/sdx?

I would like to know how to create a ntfs partition on /dev/sdx. I could not figure out if I should use partition type 7 86 or 87. What is the full list of commands to use?
18
votes
6answers
51k views

Change the number of the partition from sda1 to sda2

I have a disk with two partitions: sda1 and sda2. I would like change the number of sda1 to sda2 and sda2 to sda1. It's possible but I don't remember the procedure. i.e. My first partition will be ...
14
votes
2answers
22k views

fdisk -l shows ext3 file system as HPFS/NTFS

I have an external HDD which I formatted as NTFS partition in Windows. Now, I formatted this HDD in my linux system using the below command. mkfs.ext3 /dev/sdb1 It was formatted successfully. ...
13
votes
2answers
4k views

Will dd if=/dev/zero of=/dev/sda wipe out a pre-existing partition table?

Will # dd if=/dev/zero of=/dev/sda wipe out a pre-existing partition table? Or is it the other way around, i.e, does # fdisk /dev/sda g (for GPT) wipe out the zeros written by /dev/zero?
12
votes
1answer
9k views

How does partprobe work?

I was looking for a way to refresh the scsi bus (or any other bus, for that matter) that would allow my kernel ( 2.6.18-194-el5 on CentOS 5.5) to know about the partitions on a drive, and I couldn't ...
11
votes
3answers
48k views

How to extend logical & extended partition with fdisk

I'm trying to extend partition /dev/sda5 which is logical partition under extended partition /dev/sda2. I want to use fdisk. Procedure should be to delete both partitions and then to recreate them ...
11
votes
3answers
4k views

Why do we need to specify partition type in fdisk and later again in mkfs?

I'm a little confused about fdisk and mkfs. So - here is typical USB flash drive partitioning and formatting: umount /dev/sdb fdisk fdisk /dev/sdb Command (m for help): d Selected partition 1 ...
11
votes
4answers
55k views

Problem mounting GPT disk partition

I am trying to mount a partition on a GPT disk, but I get the following error: $ sudo mount -t ext4 /dev/sda1 disk/ mount: special device /dev/sda1 does not exist Looking at dmesg, I don't see any ...
10
votes
3answers
26k views

How do I use new fdisk table without reboot (kpartx)?

When I run fdisk and change the size of a partition, fdisk says at the end of its output: The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) I'd like to do so ...
10
votes
2answers
11k views

Programmatically partition disk

I am attempting to create a bash script which will create a new partition with a file system on a disk with existing partition(s). It looks like it's easy to create partitions programmatically with ...
9
votes
1answer
520 views

Why is the total number of hard disk sectors shown in fdisk not the same as theoretical calculation?

When we use fdisk to check a hard disk, it would show something like: Disk /dev/sda/: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors But when we ...
9
votes
1answer
7k views

reference whole disk (/dev/sda) using UUID

On my system (Debian), I can see the UUID identifier for all of my disks partitions (i.e. /dev/sda1, dev/sda2, ..) ls /dev/disk/by-uuid/ However, I don't see the UUID identifier for /dev/sda itself. ...
9
votes
1answer
13k views

cfdisk or fdisk?

While reading the man page for fdisk I came across this interesting text: There are several *fdisk programs around. Each has its problems and strengths. Try them in the order cfdisk,...
8
votes
2answers
8k views

Fixing bad blocks

After getting WARNING: Your hard drive is failing Device: /dev/sdb [SAT], 1 Offline uncorrectable sectors I run $ sudo smartctl -a /dev/sdb smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-514....
8
votes
3answers
21k views

Getting the extra GPT info; a “fdisk -l” equivalent

What is the equivalent for GPT using HDDs of: # fdisk -l /dev/hda > /mnt/sda1/hda_fdisk.info I got this from https://wiki.archlinux.org/index.php/disk_cloning (under "Create disk image") for ...
8
votes
4answers
831 views

Protecting Devices from dd and fdisk Commands

I'm wondering if there is some way to prevent certain certain devices from becoming the output file of the dd command and the target of the fdisk command. I'm currently using the two operations to set ...
7
votes
3answers
386 views

How can a disk without a partition be “partitioned” without losing data?

I have a 1TB portable hard drive that I use for backups. The entire drive (/dev/sdb) has been formatted as an ext4 filesystem. I have been reading about the benefits of btrfs for backups (checksums, ...
7
votes
1answer
21k views

“fdisk -l” output: what are Disk label type“ and ”Disk identifier"

fdisk -l output: . . Disk label type: dos Disk identifier: 0x0006a8bd . . What are Disk label type and Disk identifier? Also, apart from the manuals, where else can I find more information about ...
6
votes
4answers
2k views

Listing all devices as non-superuser

I'm trying to mount external hard drive. As I know, to mount manually, I should use fdisk -l to determine which device refers to the drive. When I'm doing so without sudo I have next output: user@...
6
votes
3answers
34k views

How do I check how much free space left on a device to create a partition

Let's say I have this virtual machine running: [root@centos ~]# fdisk -ul Disk /dev/sda: 8589 MB, 8589934592 bytes 255 heads, 63 sectors/track, 1044 cylinders, total 16777216 sectors Units = sectors ...
6
votes
1answer
13k views

How to use sudo -u option?

I have 2 users, userA and userB. userB needs to run some commands as userA. I have specified these options in /etc/sudoers as below: userA ALL=(ALL) ALL userB ALL=(vinoth) /sbin/fdisk I ran this ...
6
votes
1answer
31k views

Understanding partition table with sda1 sda2 sda5

I just inherited a system and I am trying to understand it's partition table for the hard drive. machine:~# fdisk -l /dev/sda Disk /dev/sda: 250.0 GB, 250000000000 bytes 255 heads, 63 sectors/track,...
6
votes
3answers
1k views

how to use “Unusable” sectors outside defined partition boundaries

What might be a convenient way to stash some hidden data in the "Unusable" area following the last partition, or anywhere outside defined partition boundaries? For example, making it appear as a /dev/...
6
votes
1answer
955 views

How to calculate partition Start End Sector?

I am wondering what Start and End value to choose when partitioning my ext. SSD using fdisk. fdisk suggests 2048-250069679, default 2048 but 250069679 cannot be divided by 512 nor by 2048. Wouldn't ...
6
votes
1answer
3k views

How to properly align partitions?

I'm trying to understand what are the rules for creating correctly aligned partitions. For the moment I'm playing with parted on a virtual machine, but I'm planning to move to a real hard disk when I ...
5
votes
4answers
17k views

“blocks” column in output of fdisk

On my machine, fdisk -lu /dev/sda displays following output: Device Boot Start End Blocks Id System /dev/sda1 * 2048 73947135 36972544 83 Linux /dev/sda2 ...
5
votes
3answers
611 views

What's the best way to list size of / in Terminal?

I want to see how much total space / is taking, but I don't know how to do that. I can use ls -hal and add up the subtotals, or I can use fdisk to tell me the size of that partition, but is there a ...
5
votes
6answers
29k views

Re-reading the partition table failed with error 16: Device or resource busy

When re-partitioning the USB drive on CentOS 6.x getting following error. Disk /dev/sdb: 31.5 GB, 31466323968 bytes 255 heads, 63 sectors/track, 3825 cylinders Units = cylinders of 16065 * 512 = ...
5
votes
2answers
9k views

Transforming a disk from MBR to GPT

I have a disk with classic MBR and want to transform it to use GPT without data loss. I have seen several more or less useful tutorials, but most of them are dealing with the specific problems related ...
5
votes
2answers
30k views

Partition table not recognized by Linux kernel

I experience relatively often that the partition table of a USB stick or SD card is suddenly no longer recognized by the kernel while (g)parted and fdisk still see it, as do other systems. I can even ...
5
votes
1answer
4k views

Remount lvm partitions after OS reinstallation

I recently upgraded to Linux Mint from Ubuntu. I have overwritten /dev/sda2 which had Ubuntu. I had earlier created two logical volumes opt and virtualization from /dev/sda1. I forgot to take the lvm ...
5
votes
1answer
309 views

How is the size of the block containing the “MBR” determined

I have used fdisk to move Ubuntu Mate partitions from a 1M boundary to start on a 4M boundary on a SD card. The "boot" partition now starts at block 8192. This is how the Raspbian distributions are ...
5
votes
1answer
560 views

Partitions same size but different block [closed]

I tried to backup my partition using dd on another disk and I created a partition of the same size. When I finished the copy I had problems mounting the partition since I got bad geometry: block ...
5
votes
2answers
1k views

How do I make use of unused space on my boot drive on FreeBSD

I have an old FreeBSD Server (running 7.3-RELEASE) that desperately needs additional storage. In fact, it has some-- the original 20G SCSI drives have been replaced by 300G SCSI drives, so in theory ...
5
votes
4answers
1k views

Can't access USB HDD

I just bought a WD 1TB Caviar Blue drive, and a Bytecc HD-35SU enclosure for it. Snapped the drive in, went to plug it in on my laptop, nothing happened. I figured that probably meant I needed to ...
4
votes
4answers
491 views

Combine fdisk and df in the same output

sudo fdisk -l gives : 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (...
4
votes
2answers
3k views

How to resize LVM disk in Debian 8.6 without losing data

I need to resize my first disk (/dev/xvda) from 40 GB to 80 GB. I'm using XEN virtualization, and the disk is resized in XenCenter, but I need to resize its partitions without losing any data. The ...
4
votes
1answer
3k views

Why does fdisk insist on starting the first partition at sector 65535 (MiB 31.9995…)

So, I have one of these newfangled external Samsung T3 USB SSD drives here, sized at 250 GB. Let's see what fdisk has to say about that: Disk /dev/sdb: 232.9 GiB, 250059350016 bytes, 488397168 ...
4
votes
2answers
10k views

What are the ramifications of not having a valid partition table?

I recently upgraded my Ubuntu from 11.10 (Oneiric) to 12.04 (Precise Pangolin) on a Dell Inspiron B130 Laptop. When I run fdisk -l it says that my HD doesn't contain a valid partition table. I have ...
4
votes
1answer
3k views

Software RAID 10 + LVM on mixed drives, sector alignment?

I have 4 2.5" 7.2k drives lying about and I'd like to build some RAID arrays for a bit of VM storage on my KVM lab box. There are 2x 320GB drives and 2x 500GB drives. I'm looking to create a RAID 10 ...
4
votes
2answers
774 views

Is it safe to force fdisk to use sector 63 boundary?

For some reason, the first partition of my VPS (running Debian 8) is aligned to sector 63 (instead of 2048) Model: VMware Virtual disk (scsi) Disk /dev/sda: 314572800s Sector size (logical/physical): ...
4
votes
3answers
7k views

Copy disc layout and partitions to another drive

I'm working on an application, where I need to create drives with always the exact same partition layout. My initial thought was to once dump the partition table of the original drive with sfdisk. ...
4
votes
2answers
5k views

Remove filesystem from an unpartitioned disk

I have an un-partitioned 500GB disk with a ext3 fs using the entire disk. If I make sure there are no partitions on the disk using fdisk or parted, "ssm list" will still show an ext3 fs on the disk (...
4
votes
1answer
40k views

How can I Allocate More Space to a Filesystem Mounted on /?

I am new to Linux so please forgive the incorrect use of vocabulary. My company has a private cloud that provisions VM's in a KVM. I received a RHEL 6.4. When I provisioned it, I asked for 50GB of ...
4
votes
2answers
5k views

I ran fdisk on a wrong drive. How can I recover

I ran fdisk on the wrong HD. I basically cleared partition table, pressed w and quited fdisk and only then realized that that was my main harddrive... I got this message: WARNING: Re-reading ...
4
votes
2answers
142 views

Restore a USB flash drive in a standard state for use in Linux, Windows, etc

Since this question, I'm using: dd if=/dev/zero of=/dev/sdb bs=1M # wipe the disk fdisk /dev/sdb <<< $'n\np\n\n\n\nt\nb\np\nw\n' # create a partition mkfs.fat /dev/sdb1 ...