Tag Info

Hot answers tagged

18

The simplest solution is to use GPT partitioning, a 64-bit version of Linux, and XFS: GPT is necessary because the MS-DOS-style MBR partition table created by fdisk is limited to 2 TiB disks. So, you need to use parted or another GPT-aware partitioning program instead of fdisk. (gdisk, gparted, etc.) A 64-bit kernel is necessary because 32-bit kernels ...


9

Partprobe calls the BLKRRPART ioctl, which is documented in, err, include/linux/fs.h, and beyond that the kernel source (the meat is in rescan_partitions()): #define BLKRRPART _IO(0x12,95) /* re-read partition table */ The easiest way to find this out is to run strace -e raw=ioctl -e open,ioctl partprobe /dev/sdb. I think what you tried with ...


8

Just as an alternative to the other suggestions. You don't have to partition a disk at all. You could simple create a Volume Group, with one or more Logical Volumes. pvcreate /dev/sdb vgcreate data /dev/sdb lvcreate --name dump -L '100%VG' data Now you have a logical volume that you can format with any filesystem type you wish. mkfs.XXXX ...


7

That link you posted looks like a very ugly hack type solution. However, according to the man page, gdisk, which is used to convert MBR -> GPT, also has an option in the "recovery & transformation" menu to convert GPT -> MBR; the g key will: Convert GPT into MBR and exit. This option converts as many partitions as possible into MBR form, ...


5

Use fdisk for drives that are < 2TB and either parted or gdisk for disk > 2TB. The actual difference has to do with the partitioning formats that these tools are manipulating. For disks < 2TB you're often using MBR (Master Boot Record). For disks > 2TB you're using GPT (GUID Partitioning Table). Here's a good article that covers the differences as ...


4

First, make sure you understand the difference between primary, extended and logical partitions. To create a logical partition, you first need to create the extended partition that will contain it. If there's only one partition on a drive, there's no point in not making it primary. Below I'll give instructions for a logical partition; creating a primary ...


4

Use the command kpartx to create a loopback device that can then be formatted. kpartx -a /path/to/imagefile.img # Presents partitions from the image file mkfs.vfat /dev/mapper/loop0p1 # Format partition 1 mkfs.ext3 /dev/mapper/loop0p2 # Format partition 2 kpartx -d /path/to/imagefile.img # Unmaps the partitions from the image file Related kpartx ...


4

The real limitation is that the fdisk tool in the util-linux package doesn't support GPT-type partition tables, which you can find on any disk. However, they're commonly found on disks greater than 2 GiB, because the old MBR-type partition tables don't support sizes that large. The easiest fix is, as the error suggested, to just use the GNU Parted software ...


4

The primary reason to use gparted or parted is if the new disk is bigger than 2TB. But you probably will not be able to effectively set that up from a 32 bit system. If you want to run the new disk from your old system. Stay with a disk smaller than 2TB. You should be able to partition, format and run that from you old computer using fdisk for partitioning. ...


3

You can use the same script logic for parted, but parted has to be invoked via parted -s (don't run interactively). Wheter you can use the exact same commands in your HEREDOC is unknown to me as I don't use parted. Try a manual dry run, note the commands, and put them in the HEREDOC part of your script.


3

Most of the previous respondents are correct when they say that you can usually do what you need with a GPT partition table layout, but since there are valid reasons for wanting to use MBR, I think I will just answer your question instead of assuming you are wrong for asking. To get rid of the GPT, you need to remember that with this format, there is a ...


3

parted can print free space. Example (I chose a complicated one on purpose): # parted /dev/sda unit s print free [...] Number Start End Size Type File system Flags 63s 2047s 1985s Free Space 1 2048s 4196351s 4194304s primary fat32 lba 4196352s 4198399s 2048s ...


3

The extended and logical partitions make sense only with msdos partition table. It's only purpose is to allow you to have more than 4 partitions. With GPT, there are only 'primary' partitions and their number is usually limited to 128 (however, in theory there is no upper limit implied by the disklabel format). Note that on GPT none of the partitions could ...


3

Question to the question: You asked 'how to partition 22TB disk' and then in the question again, you said, you just wanted a 22TB partition. So this is ambiguos in first place. If you already have a single block device which can support 22TB of space on it, then you already posses whole 22TB partition. All you need is a filesystem on top of it, which will ...


2

I'm not sure this is currently possible using the standard partition table. In the standard partition table scheme, volumes are limited to 232 sectors. With 512 bytes per sector, you'd simply run out numbers to assign to sectors around 2TB. However, you ought to be able to do this if you use a GUID Partition Table instead of a standard one. GUID partition ...


2

Unfortunately, I think you are quite screwed. If you only messed with the partition table then TestDisk is your best shot, but since you have been resizing (which actually means copying and maybe even deleting), your data is, more or less, corrupted. If you have a backup from before performing the resize operation, this is a good time to use it. Else, I ...


2

You shouldn't need any partitioning when using ZFS, just create a ZFS pool on your 22 TB device and a file system in it if you don't want to use the default one and that's it. If for some reason, zpool doesn't support using the whole disk, first create an EFI label and a partition using the whole space available inside then use that partition to create the ...


2

In my experience fdisk is more powerful (especially in the advanced mode), but it can leave your disk in a somewhat weird state. For example fdisk will allow your partitions to lie out of order unless you specifically tell it to reorder them, most other tools (and unless i'm very mistaken parted is one of them) will make assumptions that you want everything ...


1

I don't know about Parted, but try something like this in the shell: $ mkfs -t ntfs /dev/sdXX Do not use /dev/sdXX . First find the partition. df -H lists currently mounted ones and their size. The partition should look something like /dev/sda1 or /dev/hda1. From the man page: mkfs [options] [-t type] [fs-options] device [size] ... The device argument ...


1

Make a backup of the partition table (sfdisk -d /dev/sda >sda.txt (DOS MBR) or sgdisk --backup=<file> <device> (GPT)). Delete the partition. Restore the partition table from the backup. Warning: Under certain conditions deleting even an unused partition may prevent your Linux from booting. This can happen if the system has references to a ...


1

In looking at your output I'm thinking that you have several chunks of sectors that are not contiguous, and so when you print your partitions in parted these chunks are showing up as multiple blocks of free space. The default output of parted makes this difficult to see so I'd suggest changing the units from size based (kB, MB, GB, etc.) to sectors. You ...


1

I think parted only accepts absolutes, not x+y. You could do it like this: (+ interpreted by shell) # start=1 # size=512 # parted /dev/loop0 unit mib mkpart primary $start $(($start+$size)) # parted /dev/loop0 unit mib print free Model: Loopback device (loopback) Disk /dev/loop0: 1000MiB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk ...


1

when you get this kind of message you can easily find out what packages provides the command using yum: yum whatprovides "file" yum install "package" when you run the install and it complains already installed package you can also perform: rpm -ql "package" |grep file$ repoquery -l "package" |grep file$ To know what is the path were it is installed. We ...


1

With the usual mkfs commands, such as mkfs.ext4. You will need to use losetup to associate a loopback device with the file though in order to have somewhere to point mkfs to. You also may need to use partprobe to recognize the partitions on the loop device.


1

ext4 does not support online shrinking. You can not shrink an ext4 volume without unmounting it (with or without LVM). If the problem is that this is your rootfs, you may be able to do the shrink from initramfs—depends on if you have console access (e.g., IP KVM). If instead you wish to grow it, that's doable, provided you have free space after the ...


1

For some reason your kernel fails to read the partition table: [ 8775.030291] end_request: I/O error, dev sdb, sector 0 [ 8775.030300] quiet_error: 30 callbacks suppressed [ 8775.030306] Buffer I/O error on device sdb, logical block 0 [ 8775.033781] ldm_validate_partition_table(): Disk read failed. Thus, it can't create devices for partitions as it did ...


1

Have you tried the obvious -- simply concatenating vdb to vda and creating a new partition? I tried that and it seems to work. Here's what I did... I started with two files: # ls -l vd* -rw-r--r-- 1 root root 104857600 Feb 27 20:31 vda.raw -rw-r--r-- 1 root root 104857600 Feb 27 20:31 vdb.raw # file vd[ab].raw vda.raw: x86 boot sector; partition 1: ...


1

I had the same problem and will post how I solved it for future visitors. I found some hooks to tackle my problem at https://help.ubuntu.com/community/DataRecovery And I am currently using photorec in the TestDisk package (sudo apt-get install testdisk) after which use photorec /dev/sdXY where X is the device in question and Y is the partition number of ...



Only top voted, non community-wiki answers of a minimum length are eligible