Tag Info

Hot answers tagged

14

fdisk -l (that's lower L in the parameter) will show you, among other information, the sector size too. $ sudo fdisk -l Disk /dev/sda: 150.3 GB, 150323855360 bytes 255 heads, 63 sectors/track, 18275 cylinders, total 293601280 sectors Units = sectors of 1 * 512 = 512 bytes Device Boot Start End Blocks Id System /dev/sda1 * ...


11

According to the documentation for the queue sysfs files: # cat /sys/block/sda/queue/hw_sector_size 512


11

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 ...


11

FYI, it is a bad idea and you can lose everything. If you still want to do it, here are the steps: Don't do it. If this doesn't help, then: Use the sfdisk tool: First, make a backup of the partition table using sfdisk -d /dev/sda > sda.out Then go for it: sfdisk /dev/sda -O sda-partition-sectors.save You will see something like this Checking that ...


8

fdisk -l can just list the filesystems it has the permission to read on. See my test with strace: user@host:~/test$ strace -e open /sbin/fdisk -l ... open("/proc/partitions", O_RDONLY) = 3 open("/dev/sda", O_RDONLY) = -1 EACCES (Permission denied) open("/dev/sda1", O_RDONLY) = -1 EACCES (Permission denied) open("/dev/sda2", ...


8

The symlinks under /dev/disk/by-uuid/ are created by udev rules based on filesystems UUIDs. If you look at /usr/lib/udev/rules.d/60-persistent-storage.rules you will find entries like: ...... ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" To reference a disk you could use the disk serial number and the ENV{ID_SERIAL_SHORT} key. ...


7

@chaos and @Braiam have provided good answers on why you aren't getting the behavior you are looking for from fdisk when running as a non-root user. The simple fact is that allowing regular users to read disks directly would allow bypassing file permissions by simply reading the disk data directly, which could be a major problem and certainly would make file ...


7

When setting up a disk or partition there are 2 aspects to doing this. The first is the act of laying down a partition table scheme on the disk using typically either MBR (Master Boot Record) or GPT (GUID Partitioning Table) formats. Both of these lay down a "structure" on the disk. MBR If you take a look at the structure of an MBR you'll notice that ...


7

why can't you try df -hT? Output -bash-3.2$ df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/sda2 ext3 48G 17G 29G 37% / /dev/sda5 ext3 238G 66G 160G 30% /home /dev/sda1 ext3 99M 17M 77M 18% /boot tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm The type specifies the system type and the only ...


6

Because mkfs does not know or care about partition tables. You can use it on any block device you wish, including those that have nothing to do with a hard disk, and therefore partitions. The partition type code that fdisk puts in the msdos partition table is only a hint and is pretty much ignored by non Microsoft operating systems.


6

Are you asking about the total size of files/directories contained within /, or the total size of the root filesystem? If the former, use df -h /. If the latter, you can do this with du -sh /, which will be very slow, as it has to enumerate every single file. Better, but possibly inaccurate due to things like bind mounts, filesystems stored as sparse files ...


6

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 ...


5

The partition type is less specific than the filesystem type. Most "native" Linux filesystems use partition type 83, for example: all of the ext* variants, ReiserFS, XFS, and others. You should try switching to parted or gParted. For some filesystem types, it is able to create the partition and create a filesystem in it all within the same tool. (With some ...


5

I just did this in an easier way: # sfdisk -d /dev/sdb > sdb.bkp leave a copy for safety # cp sdb.bkp sdb.new now edit sdb.new changing ONLY the lines order and partition numbers, as in my case: from # partition table of /dev/sdb unit: sectors /dev/sdb1 : start= 1026048, size=975747120, Id=83 /dev/sdb2 : start= 2048, size= 204800, Id=83 ...


5

As root, type in a shell: # cfdisk /dev/sdX #Where /dev/sdX is the device it will show you something like this: cfdisk (util-linux-ng 2.18) Disk Drive: /dev/sdb Size: 3926949888 bytes, 3926 MB Heads: 255 Sectors per Track: 63 Cylinders: 477 Name Flags Part Type FS Type ...


5

No, you should not be required to format the CF card before installing Linux. The Syba adapter should present the CF storage to the computer as a fully-writable SATA drive, and should thus allow the Linux installer to partition and format it. The fact that the installer cannot write to the CF leads me to suspect that at least one of a few things could be ...


5

There are two places where the partition table is stored: on disk, and in RAM. It sounds like you updated the disk without updating the RAM, then changed the disk back. So if the kernel is still going on what's in RAM, and the next time you boot it reads the same thing off the disk, then yes, it should work. However, you need to be really careful that ...


5

There are usually no files in the root directory, so I assume you want to know how much space is used in the root filesystem. The command for this is df (disk free). df -h / With no arguments, df provides usage information for all filesystems (except some special, non-disk-backed filesystems for which this is irrelevant). If you want to know how much ...


5

You might try writing a udev rule to give the supplemental HDD(s) sufficiently unique names. Another idea: Whenever you can phrase a security requirement as "It's not who's doing it, it's how they're doing it" you're talking about type enforcement, and in most Linux distros TE is done at the MAC level. Most of my MAC experience is with "SELinux" You can't ...


5

On Linux traditional DOS-partitions will show up this way: Partitions from 1 to 4 are primary partitions Partitions above 5 are logical partitions. In the DOS-partitioning-scheme (this is not Linux-specific) if you want to use logical partitions you have to define a pointer within one of the primary partitions for these. At this pointer the BIOS will ...


5

If your objective is to find out the device name of the external drive you just connected, the easiest ways is to run dmesg | tail -20 or so right after connecting it: $ dmesg | tail -20 [ 5610.869053] usb 2-1.4: New USB device strings: Mfr=10, Product=11, SerialNumber=5 [ 5610.869058] usb 2-1.4: Product: Iomega Select HDD [ 5610.869062] usb 2-1.4: ...


5

The id in the partition table doesn't have to have anything to do with what's actually in the partition. For example, there's no type for an XFS filesystem -- people just use "linux" (83). fdisk will say HPFS/NTFS until you change the partition type: fdisk /dev/sdb t 1 83 w And then reboot, or reattach the drive. (make sure it's not mounted first)


5

Partition start/alignment Make them start at 1 MiB boundaries, for example using parted and unit mib. That way you won't have an issue with today's 4k sector disks, and not with tomorrow's 8k or 16k disks... and you only waste 1MiB per disk. You can verify the partition alignment of any given disk using parted /dev/disk unit b print free. It ...


4

It looks like the partition table on /dev/sda was destroyed. You didn't mention what you did to destroy it, so it's hard to say exactly how you would reconstruct it. You can attempt to use fdisk to recreate the sda1 partition. On the assumption that the disk partitions of the three disks were identical, you can recreate the sda1 partition with fdisk ...


4

With a traditional Master boot record, you only get four slots for primary or extended partitions. You already have two primary partitions, and one extended (in which you can create logical partitions). So there's only one slot left in the MBR for an additional primary partition.


4

Depending on who set up the old Windows machine (ie: if it's from HP, Lenovo, etc) you may have many different partitions on the disk that you normally wouldn't see with Windows. Those partitions might include recovery, unused space, etc. As mentioned in the answer above, use fdisk to see the partitions. fdisk -l /dev/sdb Using that information you can ...


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. ...


4

This is because super user or root has complete permissions to probe all devices while the users doesn't have such privileges by default. Whenever it tries it fails hence not listing the details. Some groups may have such privilege too which you can add yourself.


4

At first you need to unmount the second device again, before you proceed with the following steps: You will have to add the device /dev/vdb into your logical volume group VolGroup, you can do this using vgextend. vgextend VolGroup /dev/vdb After this you can first grow the logical volume lv_root to the size of the group, using lvextend. lvextend ...


4

No it doesn't generally matter, it's just setting a value in the MBR portion of the partition.                         On certain OS'es such as Windows it does a check of the parititon type that's written here and will balk if it doesn't ...



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