Monday, 29 January 2018

Fdisk and parted - creating partitions larger then 2TB - SOLVED

In case you don't know what parted is then I can only assume that you never worked with disks larger then 2 TB. Good for you.

If you do know what parted is that I also can assume that you came across problems with fdisk and disks larger then 2TB.

So what is parted?

Simple answer to this question is just another disks partitioning tool. What is so special about parted? When using parted you can create partitions that are larger then 2TB. Why? Because. Don't get to techical about it.

Can you use parted for partitions smaller then 2TB? Yes, you can! Do you use parted for partitions smaller then 2TB if you don't have partitions larger then 2TB? I don't think so. Why? Answer is pretty simple. Big disks are still expensive.

Fdisk limitations for large partitions 


Fdisk limitation is that it can't create partitions larger then 2TB. 
Example: you have a disk sdb that is 3TB. Do all things that you need for creating new partion on it.

fdisk /dev/sdb
(new primary partition, number 1, first block on disk, last block on disk)

When you are finish with creating partition, list info about it

fdisk /dev/sdb1

You will see that is it only 2TB big. Even if you did select last block on disk, you can get partition bigger then 2TB.

 

Can I still make partitions larger then 2TB with fdisk?  


Well, you can but ... you will need to to use LVM and make some tricks.
How to do it? Pretty simple really. Let's show this in an example.

If you can 3TB disks on your server,let's say it is sdb, you first create one partition. Then create second partition on save disk. So you will have sdb1 and sdb2 partition that are in total 3TB large.

Now, implement LVM on them.

Create PV on them:
pvcreate /dev/sdb1
pvcreate /dev/sdb2

Check PV
# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda2  rootvg lvm2 a-    40.00g     0
  /dev/sdb2  data_vg lvm2 a-   2.00t     0
  /dev/sdb1  data_vg lvm2 a-   1.00t  0

 

Create VG on them:
vgcreate data_vg /dev/sdb1
vgextend data_vg /dev/sdb2

You must use extend for second disks because you can't have to VG with same name.

So when you execute vgs command, you will see something like this

 # vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  data_vg   2   1   0 wz--n- 3.00tg   0 

 rootvg   1   3   0 wz--n-  90.00g 28.00g

Now you can create LV on VG data_vg that is 3TB big.

lvcreate -L3T -n data_lv data_vg

 # lvs
  LV     VG     Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  data_lv data_vg -wi-ao 3.00T 

  rootlv rootvg -wi-ao  20.00g
  varlv  rootvg -wi-ao  10.00g
 
Rest is easy, create file system on /dev/mapper/data_lv and mount it somewhere.

 

Making all this with parted


Same disk - sdb

# parted /dev/sdb
GNU Parted 2.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel GPT
Warning: The existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes 
(parted) mkpart primary 65535s 100% 
(parted) q
Information: You may need to update /etc/fstab.
# parted /dev/sdb print
Model: Unknown (unknown)
Disk /dev/sdb: 3299GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      33.6MB  3299GB  3298GB               primary 
 
And now you can create file system on sdb1 or you can create LVM on sdb1. 
 
 
 

Monday, 18 September 2017

Sles 12 emergency mode after reboot - SOLVED

Recently I had this situation. Freshly installed SLES 12.2 had a problem after reboot. For some strange reason, server entered emergency mode.

It looked like this.










Welcome to emergency mode! After logging in,type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default" or ^D
to try again to boot into default mode.
Give root password for maintainence
(or type control-D to continue):
 
 




After typing root password and executing systemctl default everything look OK. Network start to work, all services was up already. Reboot also did the same thing, everything was perfect. But next time you need to reboot, server was againg in emergency mode. So this had to be solved.

We update server, upgrade it to SLES 12.3, but problem was still there.

One thing I did notice when server was booting OK is this. Booting process was finished and log in prompt was shown but ping was dead to server IP. After a 5 seconds, EMC Networker agent started. This is showed by printing 

nsrexec

after login prompt.

After this process was started, ping start to run normally and server had network connectivity.

Networker agent version was 8.2.2.

Could this be the problem? 
I deactive proccess to start after reboot. Reboot server. Server started normally! Maybe this is a problem after all? We rebooted server 10 more times. It started normally every time!

So old version of Networker agent for some reason was entering in emergency mode. This is pretty strange because, we are running several SLES 12.2 on same hardware and we did not have this issues!

We installed latest EMC Networker agent 8.2.4, rebooted server for several times, everything looks OK. Server boot normally!