
Terminal - Commands tagged partition - 18 results
This is sample output - yours may be different.
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *750.2 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS swap 32.0 GB disk0s2
3: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF 536.9 MB disk0s3
4: Apple_HFS spare 671.1 MB disk0s4
5: Apple_CoreStorage 99.5 GB disk0s5
6: Apple_Boot Boot OS X 650.0 MB disk0s6
7: Apple_CoreStorage 616.3 GB disk0s7
8: Apple_Boot Boot OS X 134.2 MB disk0s8
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS OS *99.2 GB disk1
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *616.0 GB disk2
1: EFI 209.7 MB disk2s1
2: ZFS 615.7 GB disk2s2
/dev/disk3
#: TYPE NAME SIZE IDENTIFIER
0: zfs_pool_proxy gjp22 *614.2 GB disk3
/dev/disk4
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *640.1 GB disk4
1: EFI 209.7 MB disk4s1
2: ZFS 639.8 GB disk4s2
/dev/disk5
#: TYPE NAME SIZE IDENTIFIER
0: zfs_pool_proxy zhandy *635.7 GB disk5
1: zfs_filesystem_proxy Pocket Time Machine 85.1 GB disk5s1
/dev/disk7
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *2.0 TB disk7
1: EFI 209.7 MB disk7s1
2: ZFS 2.0 TB disk7s2
/dev/disk8
#: TYPE NAME SIZE IDENTIFIER
0: zfs_pool_proxy tall *2.0 TB disk8
1: zfs_filesystem_proxy backups 62.4 GB disk8s1
2: zfs_filesystem_proxy LaCie d2 Extreme 50.7 GB disk8s1s1
3: zfs_filesystem_proxy 11G 50.7 GB disk8s1s1s1
4: zfs_filesystem_proxy 12A 50.7 GB disk8s1s1s2
5: zfs_filesystem_proxy blocky 54.2 GB disk8s1s2
6: zfs_filesystem_proxy gjp22 376.0 GB disk8s1s3
7: zfs_filesystem_proxy zhandy 478.3 GB disk8s1s4
8: zfs_filesystem_proxy Pocket Time Machine 107.4 GB disk8s1s4s1
ls /dev/disk* | xargs -n 1 -t sudo zdb -l | grep GPTE_
This is sample output - yours may be different.
sudo zdb -l /dev/disk0
Password:
sudo zdb -l /dev/disk0s1
sudo zdb -l /dev/disk0s2
sudo zdb -l /dev/disk0s3
sudo zdb -l /dev/disk0s4
sudo zdb -l /dev/disk4
sudo zdb -l /dev/disk4s1
sudo zdb -l /dev/disk4s2
path: '/dev/dsk/GPTE_1928482A-7FE4-482D-B692-3EC6B03159BA'
path: '/dev/dsk/GPTE_1928482A-7FE4-482D-B692-3EC6B03159BA'
path: '/dev/dsk/GPTE_1928482A-7FE4-482D-B692-3EC6B03159BA'
path: '/dev/dsk/GPTE_1928482A-7FE4-482D-B692-3EC6B03159BA'
sudo zdb -l /dev/disk5
path: '/dev/dsk/GPTE_1928482A-7FE4-482D-B692-3EC6B03159BA'
path: '/dev/dsk/GPTE_1928482A-7FE4-482D-B692-3EC6B03159BA'
sudo zdb -l /dev/disk5s1
path: '/dev/dsk/GPTE_1928482A-7FE4-482D-B692-3EC6B03159BA'
path: '/dev/dsk/GPTE_1928482A-7FE4-482D-B692-3EC6B03159BA'
sudo zdb -l /dev/disk7
sudo zdb -l /dev/disk7s1
sudo zdb -l /dev/disk7s2
path: '/dev/dsk/GPTE_78301A52-4AFF-4D96-8DE9-E76ABC14909C'
path: '/dev/dsk/GPTE_78301A52-4AFF-4D96-8DE9-E76ABC14909C'
path: '/dev/dsk/GPTE_78301A52-4AFF-4D96-8DE9-E76ABC14909C'
path: '/dev/dsk/GPTE_78301A52-4AFF-4D96-8DE9-E76ABC14909C'
sudo zdb -l /dev/disk8
path: '/dev/dsk/GPTE_78301A52-4AFF-4D96-8DE9-E76ABC14909C'
path: '/dev/dsk/GPTE_78301A52-4AFF-4D96-8DE9-E76ABC14909C'
sudo zdb -l /dev/disk8s1
path: '/dev/dsk/GPTE_78301A52-4AFF-4D96-8DE9-E76ABC14909C'
path: '/dev/dsk/GPTE_78301A52-4AFF-4D96-8DE9-E76ABC14909C'
sudo zdb -l /dev/disk8s1s1
sudo zdb -l /dev/disk8s1s1s1
sudo zdb -l /dev/disk8s1s1s2
sudo zdb -l /dev/disk8s1s2
sudo zdb -l /dev/disk8s1s3
path: '/dev/dsk/GPTE_78301A52-4AFF-4D96-8DE9-E76ABC14909C'
path: '/dev/dsk/GPTE_78301A52-4AFF-4D96-8DE9-E76ABC14909C'
sudo zdb -l /dev/disk8s1s4
sudo zdb -l /dev/disk8s1s4s1
macbookpro08-centrim:~ gjp22$
lsblk -o NAME,TYPE,FSTYPE,LABEL,SIZE,MODEL,MOUNTPOINT
This is sample output - yours may be different.
Shows all block devices in a tree with descruptions of what they are.
This is sample output - yours may be different.
# blkid -pi -c /dev/null /dev/sda
MINIMUM_IO_SIZE=512
PHYSICAL_SECTOR_SIZE=512
LOGICAL_SECTOR_SIZE=512
PTTYPE=dos
# blkid -c /dev/null
/dev/mapper/srv-lvol0: UUID="ff838430-4058-47a4-abf8-91362eb57ba1" TYPE="ext3"
/dev/mapper/VolGroup00-LogVol01: TYPE="swap"
/dev/mapper/VolGroup00-LogVol02: UUID="2ba64b56-9c0c-40e1-a17b-c1bfe2040007" TYPE="ext3"
/dev/mapper/VolGroup00-LogVol00: UUID="c22f3324-8c93-4bd3-b376-eed363e0c15f" TYPE="ext3"
/dev/cciss/c0d4: UUID="07bc6be5-6f4e-409a-940c-b5ba398dd7b5" TYPE="ext4"
/dev/cciss/c0d0p1: LABEL="/boot" UUID="0cfeec27-0c44-4991-a2cb-1e881dfb98c3" TYPE="ext3"
/dev/VolGroup00/LogVol00: UUID="c22f3324-8c93-4bd3-b376-eed363e0c15f" TYPE="ext3"
/dev/VolGroup00/LogVol01: TYPE="swap"
/dev/loop0: LABEL="NOLABEL" TYPE="iso9660"
/dev/loop1: LABEL="RMO_CDROM" TYPE="iso9660"
/dev/mapper/mpath4: UUID="07bc6be5-6f4e-409a-940c-b5ba398dd7b5" TYPE="ext4"
/dev/mapper/mpath29p1: LABEL="ORADATA001" TYPE="oracleasm"
/dev/mapper/mpath16p1: UUID="79028217-73cf-497c-bcb4-2bde1cbebdeb" SEC_TYPE="ext2" TYPE="ext3"
/dev/mapper/mpath18p1: UUID="e361ac4f-a9d3-4250-a14c-1cac6881844f" SEC_TYPE="ext2" TYPE="ext3"
/dev/loop2: LABEL="INST_CD" TYPE="iso9660"
`blkid` is an interface to libuuid - it can read Device Mapper, EVMS, LVM, MD, and regular block devices.
-c /dev/null - Do not use cached output from /etc/blkid.tab or /etc/blkid/blkid.tab (RHEL)
-i - Display I/O Limits (aka I/O topology) information (not available in RHEL)
-p - Low-level superblock probing mode (not available in RHEL)
This is sample output - yours may be different.
Model: ATA ST3160811AS (scsi)
Disk /dev/sda: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 2000MB 1999MB primary ext3 boot
2 2001MB 160GB 158GB extended
5 2001MB 22.0GB 20.0GB logical ext3
6 22.0GB 26.0GB 3999MB logical ext3
7 26.0GB 29.0GB 2999MB logical ext3
8 29.0GB 33.0GB 3999MB logical ext3
9 33.0GB 37.0GB 3999MB logical linux-swap(v1)
10 37.0GB 57.0GB 20.0GB logical ext3
See size of partitions as human readable and get extra informations about hdd and partitions
fdisk -l /dev/sda | grep -E sda[0-9]+ | sed s/*// | awk '{printf ("%s %f ",$1,$2/512); if($2%512){ print "BAD" }else {print "Good"} }' | column -t
This is sample output - yours may be different.
/dev/sda1 4.000000 Good
/dev/sda2 404.000000 Good
/dev/sda3 160404.000000 Good
/dev/sda4 1520004.000000 Good
/dev/sda5 1520008.000000 Good
/dev/sda6 1521988.000000 Good
/dev/sda7 1643216.000000 Good
/dev/sda8 1659220.000000 Good
/dev/sda9 1787472.000000 Good
To get most of you HDD/SSD driver you need to make sure you partition are aligned, if not the speed penalty can be up to 50% slower!
this simple one liner will check to see if each partition start sector is divided by 512
you need to change sda with your driver
if you find the one of your partitions is not aligned use gparted to move the start sector of the partition to be divided of 512
echo "0,,L" | sfdisk /dev/sdX
This is sample output - yours may be different.
Creates a single primary partition starting at sector 0 and extending to the end of the disk. Use with care.
losetup /dev/loop0 harddrive.img; kpartx -a -v /dev/loop0; mount /dev/mapper/loop0p1 /mountpoint/
This is sample output - yours may be different.
mount -o remount,ro /dev/foo /
This is sample output - yours may be different.
Necessary for fsck for example.
The remount functionality follows the standard way how the mount command works with options from fstab. It means the mount command doesn't read fstab (or mtab) only when a device and dir are fully specified. After this call all old mount options are replaced and arbitrary stuff from fstab is ignored, except the loop= option which is internally generated and maintained by the mount command.
It does not change device or mount point.
This is sample output - yours may be different.
/dev/sda7: LABEL="fedora" UUID="ab6f0ee7-ebdd-484a-ae1a-c4053a426e0f" TYPE="ext4"
Shows the UUID of the given partition (here /dev/sda7). Doesn't need to be root.
sudo foremost -i /dev/sda -o /recovery
This is sample output - yours may be different.
The above command assumes the lost data is on /dev/sda and you previously issued the following command to mount _another_ disk or partition (/dev/sdb1) on /recovery
sudo mount /dev/sdb1 /recovery
If you don't do this, the data could be overwrited!
foremost is a very powerful carving tool. By default foremost recovers all known file types. If you want to reduce the amount of files that are recovered you can specify the file type you are looking for. Read the man page to know the available file types.
i.e to recover JPEG pictures append to foremost the switch -tjpg
df -l | grep -e "9.%" -e "100%"
This is sample output - yours may be different.
/dev/sda2 151913824 136594552 7602452 95% /
Reports all local partitions having more than 90% usage.
Just add it in a crontab and you'll get a mail when a disk is full.
(sending mail to the root user must work for that)
sfdisk -d /dev/sda | sfdisk /dev/sdb
This is sample output - yours may be different.
sfdisk -d /dev/sda | sed 's/sda/sdb/g' | sfdisk /dev/sdb
This is sample output - yours may be different.
sfdisk /dev/sdb <(sfdisk -d /dev/sda| perl -pi -e 's/sda/sdb/g')
This is sample output - yours may be different.
*as long as the drives are exactly the same* then this command copies the partition table on /dev/sda to /dev/sdb
lomount -diskimage /path/to/your/backup.img -partition 1 /mnt/foo
This is sample output - yours may be different.
Instead of calculating the offset and providing an offset option to mount, let lomount do the job for you by just providing the partition number you would like to loop mount.
This is sample output - yours may be different.
disk:
/dev/sda USB-Stick
/dev/cloop0 Disk
/dev/hda HARDDISK
partition:
/dev/sda1 Partition
/dev/hda1 Partition
/dev/hda2 Partition
cdrom:
/dev/hdc CD-ROM
floppy:
/dev/fd0 Floppy Disk
Yields entries in the form of "/dev/hda1" etc.
Use this if you are on a new system and don't know how the storage hardware (ide, sata, scsi, usb - with ever changing descriptors) is connected and which partitions are available.
Far better than using "fdisk -l" on guessed device descriptors.
INFILE=/path/to/your/backup.img; MOUNTPT=/mnt/foo; PARTITION=1; mount "$INFILE" "$MOUNTPT" -o loop,offset=$[ `/sbin/sfdisk -d "$INFILE" | grep "start=" | head -n $PARTITION | tail -n1 | sed 's/.*start=[ ]*//' | sed 's/,.*//'` * 512 ]
This is sample output - yours may be different.
alanceil@kvirasim:22:20:1:~> /sbin/sfdisk -d disk.img
# partition table of disk.img
unit: sectors
disk.img1 : start= 63, size= 128457, Id=83
disk.img2 : start= 0, size= 0, Id= 0
disk.img3 : start= 0, size= 0, Id= 0
disk.img4 : start= 0, size= 0, Id= 0
root@kvirasim:22:20:0:~> INFILE=/home/alanceil/disk.img; MOUNTPT=/mnt/gen; PARTITION=1; mount "$INFILE" "$MOUNTPT" -o loop,offset=$[ `/sbin/sfdisk -d "$INFILE" | grep "start=" | head -n $PARTITION | tail -n1 | sed 's/.*start=[ ]*//' | sed 's/,.*//'` * 512 ]
root@kvirasim:22:22:0:~> mount | grep gen
/dev/loop0 on /mnt/gen type ext2 (rw,offset=32256)
Suppose you made a backup of your hard disk with dd:
dd if=/dev/sda of=/mnt/disk/backup.img
This command enables you to mount a partition from inside this image, so you can access your files directly.
Substitute PARTITION=1 with the number of the partition you want to mount (returned from sfdisk -d yourfile.img).