Setup a RAID1 with MSADM - unexpected type for second hd in lsblk - linux

I tried to setup a RAID1 with mdadm on a Raspberrypi 4. I'm not sure if the raid is configured correctly.
Here is what lsblk shows before setup:
pi#e11:/dev $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
sdb 8:16 0 931.5G 0 disk
mmcblk0 179:0 0 59.5G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 59.2G 0 part /
Here is what I did:
pi#e11:/dev $ sudo parted /dev/sda "mklabel gpt"
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
Information: You may need to update /etc/fstab.
pi#e11:/dev $ sudo parted /dev/sdb "mklabel gpt"
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
Information: You may need to update /etc/fstab.
pi#e11:/dev $ sudo parted /dev/sda "mkpart primary ext4 1M -1"
Information: You may need to update /etc/fstab.
pi#e11:/dev $ sudo parted /dev/sdb "mkpart primary ext4 1M -1"
Information: You may need to update /etc/fstab.
pi#e11:/dev $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
└─sda1 8:1 0 931.5G 0 part
sdb 8:16 0 931.5G 0 disk
└─sdb1 8:17 0 931.5G 0 part
mmcblk0 179:0 0 59.5G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 59.2G 0 part /
pi#e11:/dev $ sudo parted /dev/sda "set 1 raid on"
Information: You may need to update /etc/fstab.
pi#e11:/dev $ sudo parted /dev/sdb "set 1 raid on"
Information: You may need to update /etc/fstab.
pi#e11:/dev $ sudo parted -s /dev/sda print
Model: TOSHIBA External USB 3.0 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1000GB 1000GB primary raid
pi#e11:/dev $ sudo parted -s /dev/sdb print
Model: TOSHIBA External USB 3.0 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1000GB 1000GB primary raid
pi#e11:/dev $ sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
Lsblk after:
pi#e11:/dev $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
└─sda1 8:1 0 931.5G 0 part
└─md0 9:0 0 931.4G 0 raid1
sdb 8:16 0 931.5G 0 disk
└─sdb1 8:17 0 931.5G 0 part
mmcblk0 179:0 0 59.5G 0 disk
├─mmcblk0p1 179:1 0 256M 0 part /boot
└─mmcblk0p2 179:2 0 59.2G 0 part /
I would expect that sdb1 should also look like sda1, shouldn't it?
sda 8:0 0 931.5G 0 disk
└─sda1 8:1 0 931.5G 0 part
└─md0 9:0 0 931.4G 0 raid1
sdb 8:16 0 931.5G 0 disk
└─sdb1 8:17 0 931.5G 0 part
└─md0 9:0 0 931.4G 0 raid1
If i am right. What else can I do add sdb1 to the raid array?
Thanks in advance.
Christoph

As it turned out The power supply (15W) was not enough for Raspi 4 and the two disks. With an active USB hub everything works as expected now.

Related

Increate xfs partition size lvm

I am trying to increase xfs disk lvm but I am missing something
"/" size is 70 GB and I want to enlarge it to 90GB .
I enlarged the underlying /dev/sda size to 140gb (it was 120gb) So I have enough space to add.
Also - vgdisplay lvdisplay shows nothing.
Any idea ?
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 140G 0 disk
├─sda1 8:1 0 600M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 137.2G 0 part
├─rhel_dent--sasacprd01-root 253:0 0 70G 0 lvm /
├─rhel_dent--sasacprd01-swap 253:1 0 7.9G 0 lvm [SWAP]
└─rhel_dent--sasacprd01-home 253:2 0 40.5G 0 lvm /home
sr0
[root#sasacprd01 tmp]# xfs_growfs -D 23470080 /
4096 blocks 18350080
data size 23470080 too large, maximum is 18350080
SO -that didnt work.. enter code here
Thank you
Try this.
lvextend -L +90G /dev/mapper/rhel_dent--sasacprd01-root
xfs_growfs /dev/mapper/rhel_dent--sasacprd01-root

(linux) gzip fails with No space left on device

I need to compress a directory on my Ubuntu server. The directory is about 3.2 Go, and I have 15 Go left over 20 Go available on my server.
I'm using the command: tar -zcvf test src_directory
The command fails with the message:
gzip: stdout: No space left on device
tar: test: Wrote only 6144 of 10240 bytes
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Why is it failing as I have enough space on my server ? (15 Go should be enough)
thanks
EDIT
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 463M 0 463M 0% /dev
tmpfs 98M 2.2M 96M 3% /run
/dev/xvda1 20G 17G 2.2G 89% /
tmpfs 490M 0 490M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 490M 0 490M 0% /sys/fs/cgroup
tmpfs 24K 0 24K 0% /var/gandi
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 20G 0 disk
└─xvda1 202:1 0 20G 0 part /
xvdz 202:6400 0 512M 0 disk
├─xvdz1 202:6401 0 502M 0 part [SWAP]
└─xvdz2 202:6402 0 10M 0 part
with df, I can see there is only 2.2G left on the disk. How can I have details about what is taking so much space ? Because I know that my application files only take 4.6G.
thanks
Check whether you have enough memory available on the partition you want the archive to be stored in
$: df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 476G 300G 176G 63% /
Also check if you have the permissions necessary to archive the desired directory.
If the problem still persists, I may suggest a filesystem check
$: lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 698.7G 0 disk
├─sda1 8:1 0 500M 0 part /boot
├─sda2 8:2 0 5.8G 0 part [SWAP]
├─sda3 8:3 0 50G 0 part /
├─sda4 8:4 0 1K 0 part
└─sda5 8:5 0 642.4G 0 part /home
# Find the device that matches the mountpoint of the directory in question
# Replace X with the appropriate device
# Replace Y with the appropriate partition
$: sudo fsck -vcck /dev/sdXY

Linux read external disk data, cannot mount

I just received a hard disk from other people and it includes some data. I want to read the data inside this disk. However, when I try to mount it, it shows:
~ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
├─sda1 8:1 0 217G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 16G 0 part [SWAP]
sdc 8:32 0 74.6G 0 disk
sr0 11:0 1 1024M 0 rom
~ sudo mount /dev/sdc /media/new
mount: /dev/sdc: can't read superblock
~ udisksctl mount -b /dev/sdc
Object /org/freedesktop/UDisks2/block_devices/sdc is not a mountable filesystem.
So what can I do to read the data inside this disk? I am not sure whether I can use command like mkfs.ext4 /dev/sdc, which seems will initialize the disk and erase the data.
Have you tried to use gparted to get some infos ?

missing partition in server centos 6.1

I used the command df-h on my centos 6.1
here's the output
[root#localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
50G 2.3G 45G 5% /
tmpfs 5.9G 0 5.9G 0% /dev/shm
/dev/sda1 485M 35M 425M 8% /boot
/dev/mapper/VolGroup-lv_home
2.0T 199M 1.9T 1% /home
i found out that the hard disk is two terabyte. but when I used the command cat /proc/partitions | more
here's the output
[root#localhost sysconfig]# cat /proc/partitions | more
major minor #blocks name
8 0 4293656576 sda
8 1 512000 sda1
8 2 2146970624 sda2
253 0 52428800 dm-0
253 1 14417920 dm-1
253 2 2080120832 dm-2
you could see on the first line. it is 4396.7 GB . why is it i could only see is 2TB? how could i find my missing another 2TB and make it a partition.
I also use the command lsblk
here is the output
[root#localhost ~]# lblsk
-bash: lblsk: command not found
[root#localhost ~]# lsblk
NAME MAJ:MIN RM SIZE RO MOUNTPOINT
sda 8:0 0 4T 0
ââsda1 8:1 0 500M 0 /boot
ââsda2 8:2 0 2T 0
ââVolGroup-lv_root (dm-0) 253:0 0 50G 0 /
ââVolGroup-lv_swap (dm-1) 253:1 0 13.8G 0 [SWAP]
ââVolGroup-lv_home (dm-2) 253:2 0 2T 0 /home
sr0 11:0 1 1024M 0
using the parted /dev/sda i type the print free command
here's the output
(parted) print free
Model: DELL PERC 6/i (scsi)
Disk /dev/sda: 4397GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Number Start End Size Type File system Flags
32.3kB 1049kB 1016kB Free Space
1 1049kB 525MB 524MB primary ext4 boot
2 525MB 2199GB 2198GB primary lvm
2199GB 4397GB 2198GB Free Space
I was wrong, sorry. As you can see in parted print free output you have 2 MBR partitions - boot and lvm and 2198GB free space (last row).
If you want to use all of your space you have to use GPT partitions. These partitions as opposed to MBR partition that can only address up to 2TB, can address your whole disk and up to 8 ZiB (zebibytes).
You can try to convert MBR partition table to GPT (example 1, example 2), though I strongly recommend to backup your data.
You are using tools showing info from different layers of your system and interpreting it wrong.
df, according to man page, will display the space available on all currently mounted file systems.
/proc/partitions holds info about partitions on your drive - physical device. This file shows you size of your drive as number of blocks. Usually, on HDD block size is a size of sector - 512 bytes.
So, sda size of 4293656576 is size in blocks, not kilobytes.
4293656576 blocks = (4293656576 / 2 ) kilobytes = 2146828288 KiB = 2047.375 GiB, or 2198.352 GB.
Assuming 1 GiB = 1 * 2^30, 1 GB = 1 * 10^3.
If you want to see size of your disk use fdisk -l <device name>.

How to mount an attached EC2 volume in CLI?

I just recovered data from an ec2 snapshot and created a volume with the data, i also attached the volume to my working instance, but I have problems mounting the new volume. On ec2-describe-volumes, I do get the find new volume created.
i-14305121 /dev/sdi
How do I mount this /dev/sdi on to a directory so that I can access the files on it? I tried mount /dev/sdi, but I got an error: mount: special device /dev/sdi does not exist.
On running lsblk from terminal, i get this
dev1#ip-10-244-164-7:/$ lsblk /dev/sdi
lsblk: /dev/sdi: not a block device
dev1#ip-10-244-164-7:/$ lsblk /dev/xvdi
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvdi 202:128 0 8G 0 disk
On running mount /dev/xvdi, I also get this error. Other details of fdisk, mtab are also given here:
dev1#ip-10-244-164-7:/$ sudo mount /dev/xvdi /backup
mount: can't find /backup in /etc/fstab or /etc/mtab
dev1#ip-10-244-164-7:/$ cat /etc/fstab
LABEL=cloudimg-rootfs / ext4 defaults 0 0
dev1#ip-10-244-164-7:/$ cat etc/mtab
/dev/xvda1 / ext4 rw 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0
none /sys/fs/cgroup tmpfs rw 0 0
none /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
udev /dev devtmpfs rw,mode=0755 0 0
devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
tmpfs /run tmpfs rw,noexec,nosuid,size=10%,mode=0755 0 0
none /run/lock tmpfs rw,noexec,nosuid,nodev,size=5242880 0 0
none /run/shm tmpfs rw,nosuid,nodev 0 0
none /run/user tmpfs rw,noexec,nosuid,nodev,size=104857600,mode=0755 0 0
dev1#ip-10-244-164-7:/$ sudo fdisk -l
Disk /dev/xvda1: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders, total 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/xvda1 doesn't contain a valid partition table
Disk /dev/xvdi: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders, total 16777216 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/xvdi doesn't contain a valid partition table
dev1#ip-10-244-164-7:/$
I'm not sure if this is a good answer, try running:
lsblk /dev/sdi
And it may list partitions that exists on that drive like this:
sdi
|--sdi1
|--sdi2
|--sdi3
If you have something like sdi1 you can try to mount it:
mount /dev/sdi1 /your/folder/here
Hope it helps.
I think you should try
mount /dev/xvdi /your/folder
In EC2 devices are named differently from what they promise in AWS console. See EC2: EBS device id confusion (/dev/sdf vs. /dev/xvdf)

Resources