lundi 3 août 2015

How to iterate through block devices using python

I have around 10 EBS volumes attached to a single instance. Below is e.g., of lsblk for some of them. Here we can't simply mount xvdf or xvdp to some location but actual point is xvdf1, xvdf2, xvdp which are to be mounted. I want to have a script that would allow me to iterate through all the points under xvdf, xvdp etc. using python. I m newbie to python.

[root@ip-172-31-1-65 ec2-user]# lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvdf    202:80   0   35G  0 disk 
├─xvdf1 202:81   0  350M  0 part 
└─xvdf2 202:82   0 34.7G  0 part
xvdp   202:0    0    8G  0 disk 
└─xvdp1 202:1    0    8G  0 part




Aucun commentaire:

Enregistrer un commentaire